Class 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 Detail

      • DEFAULT_SPARKLINE_LENGTH

        public static int DEFAULT_SPARKLINE_LENGTH
      • DEFAULT_SPARKLINE_TYPE

        public static boolean DEFAULT_SPARKLINE_TYPE
    • 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