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
Modifier and TypeFieldDescriptionstatic int
static boolean
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRunListener
(RunListener runListener) Adds a run listener.void
endAt
(double tick) Sets the run to end at the specified tick.void
endRun()
Ends the current run as soon as possibleGets the schedule on which the current run's events are scheduled for execution.static RunEnvironment
Gets the current RunEnvironment.Gets the parameters for the current run.int
int
boolean
static void
init
(ISchedule schedule, Runner scheduleRunner, Parameters parameters, boolean isBatch) Initializes a RunEnvironment.boolean
isBatch()
Gets whether or not this run is part of a series of batch runs.void
pauseAt
(double tick) Sets the run to pause at the specified tick.void
pauseRun()
Pauses the current run as soon as possible.void
removeRunListener
(RunListener runListener) Removes a run listener.void
Resumes the current run.void
setParameters
(Parameters params) Sets the parameters for the current run.void
setScheduleTickDelay
(int scheduleTickDelay) Set the delay between schedule executions.void
setSparklineLength
(int sparklineLength) void
setSparklineType
(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
-