Class AbstractRunner
- java.lang.Object
-
- repast.simphony.engine.environment.AbstractRunner
-
- Direct Known Subclasses:
BatchScheduleRunner
,DefaultScheduleRunner
,GUIScheduleRunner
,InteractivBatchRunner
public abstract class AbstractRunner extends Object implements Runner
- Author:
- Nick Collier
-
-
Field Summary
Fields Modifier and Type Field Description protected Controller
controller
protected RunEnvironmentBuilder
environmentBuilder
protected boolean
pause
protected ArrayList<RunListener>
runListeners
protected boolean
step
protected boolean
stop
protected Thread
thread
-
Constructor Summary
Constructors Constructor Description AbstractRunner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRunListener(RunListener listener)
Adds the specified listener to the list of RunListener-s to be notified of any run related events, such as stopped, started, and so on.protected void
firePausedMessage()
Fires a paused message to all registered run listeners.protected void
fireRestartedMessage()
Fires a restarted message to all registered run listeners.protected void
fireStartedMessage()
Fires a started message to all registered run listeners.protected void
fireStoppedMessage()
Fires a stopped message to all registered run listeners.boolean
go()
Specifies if the simulation should continue to run (returns true) or if it should stop (returns false).void
init()
void
removeRunListener(RunListener listener)
Removes the specified RunListener from the list for RunListener notified by this runner.void
setController(Controller controller)
void
setEnvironmentBuilder(RunEnvironmentBuilder environment)
void
setPause(boolean pause)
void
step()
void
stop()
Stops the execution of the scheduled events after the any events scheduled for the current tick have been executed.
-
-
-
Field Detail
-
stop
protected boolean stop
-
pause
protected boolean pause
-
step
protected boolean step
-
runListeners
protected ArrayList<RunListener> runListeners
-
thread
protected Thread thread
-
environmentBuilder
protected RunEnvironmentBuilder environmentBuilder
-
controller
protected Controller controller
-
-
Method Detail
-
addRunListener
public void addRunListener(RunListener listener)
Adds the specified listener to the list of RunListener-s to be notified of any run related events, such as stopped, started, and so on.- Specified by:
addRunListener
in interfaceRunner
- Parameters:
listener
- the listener to add.
-
removeRunListener
public void removeRunListener(RunListener listener)
Description copied from interface:Runner
Removes the specified RunListener from the list for RunListener notified by this runner.- Specified by:
removeRunListener
in interfaceRunner
-
fireStartedMessage
protected void fireStartedMessage()
Fires a started message to all registered run listeners.
-
fireStoppedMessage
protected void fireStoppedMessage()
Fires a stopped message to all registered run listeners.
-
setEnvironmentBuilder
public void setEnvironmentBuilder(RunEnvironmentBuilder environment)
- Specified by:
setEnvironmentBuilder
in interfaceRunner
-
firePausedMessage
protected void firePausedMessage()
Fires a paused message to all registered run listeners.
-
fireRestartedMessage
protected void fireRestartedMessage()
Fires a restarted message to all registered run listeners.
-
stop
public void stop()
Stops the execution of the scheduled events after the any events scheduled for the current tick have been executed.
-
go
public boolean go()
Description copied from interface:Runner
Specifies if the simulation should continue to run (returns true) or if it should stop (returns false).
-
setController
public void setController(Controller controller)
- Specified by:
setController
in interfaceRunner
-
-