org.eclipse.ohf.stem.jobs.simulation
Class Simulation

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.core.internal.jobs.InternalJob
          extended by org.eclipse.core.runtime.jobs.Job
              extended by org.eclipse.ohf.stem.jobs.simulation.Simulation
All Implemented Interfaces:
java.lang.Comparable, org.eclipse.core.runtime.IAdaptable, ISimulation

public class Simulation
extends org.eclipse.core.runtime.jobs.Job
implements ISimulation

This class implements the main simulation logic of the STEM system. It runs in the background as a seperate "Job" in eclipse.


Field Summary
 
Fields inherited from class org.eclipse.core.runtime.jobs.Job
ASYNC_FINISH, BUILD, DECORATE, INTERACTIVE, LONG, NONE, RUNNING, SHORT, SLEEPING, WAITING
 
Fields inherited from interface org.eclipse.ohf.stem.jobs.simulation.ISimulation
TOTAL_WORK
 
Constructor Summary
Simulation(Scenario scenario)
          Constructor
Simulation(java.lang.String title)
           
 
Method Summary
 void addSimulationListener(ISimulationListener listener)
           
 java.lang.String getNameWithSequenceNumber()
           
 Scenario getScenario()
           
 int getSequenceNumber()
           
 SimulationState getSimulationState()
           
 void pause()
          Pause the simulation
 void removeSimulationListener(ISimulationListener listener)
           
 void reset()
          Reset the simulation.
 void run()
          Start running the simulation.
 void setSequenceNumber(int sequenceNumber)
           
 void step()
          Step the simulation one step/cycle if it hasn't already ended
 void stop()
          Stop the simulation;
 java.lang.String toString()
           
 
Methods inherited from class org.eclipse.core.runtime.jobs.Job
addJobChangeListener, belongsTo, cancel, done, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, removeJobChangeListener, schedule, schedule, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, wakeUp, wakeUp
 
Methods inherited from class org.eclipse.core.internal.jobs.InternalJob
compareTo
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.ohf.stem.jobs.simulation.ISimulation
getName
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

Simulation

public Simulation(java.lang.String title)
Parameters:
title - the title of the simulation.

Simulation

public Simulation(Scenario scenario)
Constructor

Parameters:
scenario - the Scenario to simulate
Method Detail

getSimulationState

public final SimulationState getSimulationState()
Specified by:
getSimulationState in interface ISimulation
Returns:
the state of the simulation

getSequenceNumber

public int getSequenceNumber()
Specified by:
getSequenceNumber in interface ISimulation
Returns:
the sequence number of the simulation.
See Also:
ISimulation.getSequenceNumber()

setSequenceNumber

public void setSequenceNumber(int sequenceNumber)
Specified by:
setSequenceNumber in interface ISimulation
Parameters:
sequenceNumber - The sequence number of the simulation
See Also:
ISimulation.setSequenceNumber(int)

getNameWithSequenceNumber

public java.lang.String getNameWithSequenceNumber()
Specified by:
getNameWithSequenceNumber in interface ISimulation
Returns:
the name of the simulation prefixed by the sequence number. (e.g., : "[12] Some Simulation")
See Also:
ISimulation.getNameWithSequenceNumber()

run

public final void run()
Start running the simulation.

Specified by:
run in interface ISimulation

pause

public final void pause()
Pause the simulation

Specified by:
pause in interface ISimulation

reset

public final void reset()
Reset the simulation.

Specified by:
reset in interface ISimulation

step

public final void step()
Step the simulation one step/cycle if it hasn't already ended

Specified by:
step in interface ISimulation

stop

public final void stop()
Stop the simulation;

Specified by:
stop in interface ISimulation

getScenario

public final Scenario getScenario()
Specified by:
getScenario in interface ISimulation
Returns:
the scenario

addSimulationListener

public void addSimulationListener(ISimulationListener listener)
Specified by:
addSimulationListener in interface ISimulation
See Also:
ISimulation.addSimulationListener(org.eclipse.ohf.stem.jobs.simulation.ISimulationListener)

removeSimulationListener

public void removeSimulationListener(ISimulationListener listener)
Specified by:
removeSimulationListener in interface ISimulation
See Also:
ISimulation.removeSimulationListener(org.eclipse.ohf.stem.jobs.simulation.ISimulationListener)

toString

public java.lang.String toString()
Overrides:
toString in class org.eclipse.core.internal.jobs.InternalJob
Returns:
the title of the scenario