Class RunEnvironment
java.lang.Object
repast.simphony.engine.environment.RunEnvironment
Provides access to the environment in which a particular model run executes.
For example, the schedule is made available to running simulation code in
this way.
- Author:
- Nick Collier
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intstatic boolean -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRunListener(RunListener runListener) Adds a run listener.voidendAt(double tick) Sets the run to end at the specified tick.voidendRun()Ends the current run as soon as possibleGets the schedule on which the current run's events are scheduled for execution.static RunEnvironmentGets the current RunEnvironment.Gets the parameters for the current run.intintbooleanstatic voidinit(ISchedule schedule, Runner scheduleRunner, Parameters parameters, boolean isBatch) Initializes a RunEnvironment.booleanisBatch()Gets whether or not this run is part of a series of batch runs.voidpauseAt(double tick) Sets the run to pause at the specified tick.voidpauseRun()Pauses the current run as soon as possible.voidremoveRunListener(RunListener runListener) Removes a run listener.voidResumes the current run.voidsetParameters(Parameters params) Sets the parameters for the current run.voidsetScheduleTickDelay(int scheduleTickDelay) Set the delay between schedule executions.voidsetSparklineLength(int sparklineLength) voidsetSparklineType(boolean sparklineType)
-
Field Details
-
DEFAULT_SPARKLINE_LENGTH
public static int DEFAULT_SPARKLINE_LENGTH -
DEFAULT_SPARKLINE_TYPE
public static boolean DEFAULT_SPARKLINE_TYPE
-
-
Method Details
-
getScheduleTickDelay
public int getScheduleTickDelay() -
setScheduleTickDelay
public void setScheduleTickDelay(int scheduleTickDelay) Set the delay between schedule executions.- Parameters:
scheduleTickDelay- the delay between schedule executions.
-
getSparklineType
public boolean getSparklineType() -
setSparklineType
public void setSparklineType(boolean sparklineType) -
getSparklineLength
public int getSparklineLength() -
setSparklineLength
public void setSparklineLength(int sparklineLength) -
getInstance
Gets the current RunEnvironment.- Returns:
- the current RunEnvironment.
-
init
public static void init(ISchedule schedule, Runner scheduleRunner, Parameters parameters, boolean isBatch) Initializes a RunEnvironment. RunEnvironment.getInstance() will return null until this is called.- Parameters:
schedule-scheduleRunner-
-
getCurrentSchedule
Gets the schedule on which the current run's events are scheduled for execution.- Returns:
- the schedule on which the current run's events are scheduled for execution.
-
pauseAt
public void pauseAt(double tick) Sets the run to pause at the specified tick.- Parameters:
tick- the tick at which to pause
-
pauseRun
public void pauseRun()Pauses the current run as soon as possible. -
resumeRun
public void resumeRun()Resumes the current run. -
endAt
public void endAt(double tick) Sets the run to end at the specified tick.- Parameters:
tick- the tick at which to end.
-
endRun
public void endRun()Ends the current run as soon as possible -
isBatch
public boolean isBatch()Gets whether or not this run is part of a series of batch runs.- Returns:
- true if this run is part of a series of batch runs, otherwise false.
-
getParameters
Gets the parameters for the current run.- Returns:
- the parameters for the current run.
-
setParameters
Sets the parameters for the current run. In general this should only be used before a run has been runInitialized.- Parameters:
params- the runs parameters
-
addRunListener
Adds a run listener.- Parameters:
runListener- the run listener
-
removeRunListener
Removes a run listener.- Parameters:
runListener- the run listener
-