Class MasterSimulationFeature

java.lang.Object
jadex.execution.impl.ExecutionFeature
jadex.simulation.impl.MasterSimulationFeature
All Implemented Interfaces:
jadex.execution.IExecutionFeature, jadex.execution.impl.IInternalExecutionFeature, ISimulationFeature

public class MasterSimulationFeature extends jadex.execution.impl.ExecutionFeature implements ISimulationFeature
The master simulation feature does the actual work and holds the step queue and timer entries for all components of a simulation.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
     

    Nested classes/interfaces inherited from class jadex.execution.impl.ExecutionFeature

    jadex.execution.impl.ExecutionFeature.ComponentSuspendable, jadex.execution.impl.ExecutionFeature.ThreadRunner
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    Count busy components when in parallel mode.
    protected long
     
    protected boolean
    Flag indicating that the simulation is active.
    protected jadex.future.Future<Void>
    Inform stop() callers when simulation stops (if any).
     

    Fields inherited from class jadex.execution.impl.ExecutionFeature

    do_switch, endfuture, endstep, entries, executing, listeners, LOCAL, runner, self, steps, terminated, threads
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    protected void
     
    long
     
    protected void
     
    void
    scheduleStep(jadex.execution.impl.ExecutionFeature exe, Runnable r)
     
    void
    setTime(long millis)
    Set the current time.
    void
    Start the simulation.
    jadex.future.IFuture<Void>
    Stop the simulation.
    jadex.future.ITerminableFuture<Void>
    waitForDelay(long millis)
     

    Methods inherited from class jadex.execution.impl.ExecutionFeature

    addStepListener, afterBlock, afterStep, beforeBlock, beforeStep, busy, doRun, executeEndStep, getComponent, isComponentThread, removeStepListener, restart, saveEndStep, scheduleStep, scheduleStep, scheduleStep, scheduleStep, terminate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jadex.execution.IExecutionFeature

    getComponent, isComponentThread, scheduleStep, scheduleStep, scheduleStep, scheduleStep
  • Field Details

    • simulating

      protected boolean simulating
      Flag indicating that the simulation is active.
    • stopping

      protected jadex.future.Future<Void> stopping
      Inform stop() callers when simulation stops (if any).
    • timer_entries

      protected Queue<MasterSimulationFeature.TimerEntry> timer_entries
    • current_time

      protected long current_time
    • busy

      protected volatile int busy
      Count busy components when in parallel mode.
  • Constructor Details

    • MasterSimulationFeature

      public MasterSimulationFeature()
  • Method Details

    • scheduleStep

      public void scheduleStep(jadex.execution.impl.ExecutionFeature exe, Runnable r)
    • waitForDelay

      public jadex.future.ITerminableFuture<Void> waitForDelay(long millis)
      Specified by:
      waitForDelay in interface jadex.execution.IExecutionFeature
      Overrides:
      waitForDelay in class jadex.execution.impl.ExecutionFeature
    • getTime

      public long getTime()
      Specified by:
      getTime in interface jadex.execution.IExecutionFeature
      Overrides:
      getTime in class jadex.execution.impl.ExecutionFeature
    • setTime

      public void setTime(long millis)
      Description copied from interface: ISimulationFeature
      Set the current time. Time entries older than the given time will be executed when the simulation is running, but receive the new current time in IExecutionFeature.getTime()
      Specified by:
      setTime in interface ISimulationFeature
      Parameters:
      millis - The time in milliseconds.
    • start

      public void start()
      Description copied from interface: ISimulationFeature
      Start the simulation. Used to resume a simulation after it was stopped.
      Specified by:
      start in interface ISimulationFeature
    • stop

      public jadex.future.IFuture<Void> stop()
      Description copied from interface: ISimulationFeature
      Stop the simulation. Stops scheduling of due time entries, i.e., the time will no longer advance. Note, that components will continue to execute as long as they have activities for the current time.
      Specified by:
      stop in interface ISimulationFeature
      Returns:
      A future to indicate that simulation has stopped, i.e., all components have finished their activities.
    • idle

      protected void idle()
      Overrides:
      idle in class jadex.execution.impl.ExecutionFeature
    • componentBusy

      protected void componentBusy()
    • componentIdle

      protected void componentIdle()