fr.lifl.jedi.controllersCore.simulationRun
Class SimulationThread

java.lang.Object
  extended by java.lang.Thread
      extended by fr.lifl.jedi.controllersCore.simulationRun.SimulationThread
All Implemented Interfaces:
java.lang.Runnable

public class SimulationThread
extends java.lang.Thread

This class defines a Thread instance that runs the simulation. This class sends messages to the simulation core to tell it whenever it ends a simulation step, when the simulation aborted or ended. When a simulation step ends, the runnable instance will wait for the simulation core to notify it to continue, when all GUIs have finished updating.

Version:
JEDI V 2.2
Created the 3rd april 2009
Modified the 5th may 2009
Author:
Yoann Kubera
SMAC Team (Systèmes Multi-Agents et Comportement)
LIFL (Laboratoire d'Informatique Fondamentale de Lille)
University of Lille, France

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  SimulationCore core
          The simulation core that runs a simulation thanks to this instance.
protected  int currentSimulationStep
          The current simulation time step.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SimulationThread(SimulationCore core)
          Constructor of this class.
 
Method Summary
 void addObserver(java.util.Observer o)
           
 void deleteObserver(java.util.Observer o)
           
 int getCurrentSimulationStep()
          Gets the current simulation step.
 void run()
           
 void scheduleSingleStep()
          Schedules a single simulation step.
 void setAbort()
          Schedules the abortion of the simulation.
 void setPaused()
          Makes sure that the simulation core will be in pause mode after performing the current time step.
 void setUnPaused()
          Makes sure that the simulation core will no longer be in pause mode after performing the current time step.
protected  void step()
          Performs one simulation time step.
 void stopWaitingForNotification()
          Tells the Thread that it does not have to wait for a notification from the simulation core anymore.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

core

protected SimulationCore core
The simulation core that runs a simulation thanks to this instance.


currentSimulationStep

protected int currentSimulationStep
The current simulation time step.

Constructor Detail

SimulationThread

public SimulationThread(SimulationCore core)
Constructor of this class.

Parameters:
core - The simulation core that runs a simulation thanks to this instance.
Method Detail

getCurrentSimulationStep

public int getCurrentSimulationStep()
Gets the current simulation step.

Returns:
the current simulation step.

setPaused

public void setPaused()
Makes sure that the simulation core will be in pause mode after performing the current time step.


setUnPaused

public void setUnPaused()
Makes sure that the simulation core will no longer be in pause mode after performing the current time step.


scheduleSingleStep

public void scheduleSingleStep()
Schedules a single simulation step.


setAbort

public void setAbort()
Schedules the abortion of the simulation.


stopWaitingForNotification

public void stopWaitingForNotification()
Tells the Thread that it does not have to wait for a notification from the simulation core anymore.


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Runnable.run()

step

protected void step()
Performs one simulation time step.

During that process, every agent will have the opportunity to initiate interactions in a particular order.

By default, this order is a random one (see RandomAgentOrderingPolicy).

Nevertheless, this order can be redefined, thanks to the


addObserver

public void addObserver(java.util.Observer o)
See Also:
Observable.addObserver(java.util.Observer)

deleteObserver

public void deleteObserver(java.util.Observer o)
See Also:
Observable.deleteObserver(java.util.Observer)