Class RunEnvironment
- java.lang.Object
-
- repast.simphony.engine.environment.RunEnvironment
-
public class RunEnvironment extends Object
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
Fields Modifier and Type Field Description static int
DEFAULT_SPARKLINE_LENGTH
static boolean
DEFAULT_SPARKLINE_TYPE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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 possibleISchedule
getCurrentSchedule()
Gets the schedule on which the current run's events are scheduled for execution.static RunEnvironment
getInstance()
Gets the current RunEnvironment.Parameters
getParameters()
Gets the parameters for the current run.int
getScheduleTickDelay()
int
getSparklineLength()
boolean
getSparklineType()
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
resumeRun()
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)
-
-
-
Method Detail
-
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
public static RunEnvironment 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
public ISchedule 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
public Parameters getParameters()
Gets the parameters for the current run.- Returns:
- the parameters for the current run.
-
setParameters
public void setParameters(Parameters params)
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
public void addRunListener(RunListener runListener)
Adds a run listener.- Parameters:
runListener
- the run listener
-
removeRunListener
public void removeRunListener(RunListener runListener)
Removes a run listener.- Parameters:
runListener
- the run listener
-
-