simulation
Class Simulator

java.lang.Object
  extended by simulation.Simulator

public class Simulator
extends java.lang.Object

The Class Simulator controls the simulation.

Author:
Kevin Pucknat

Constructor Summary
Simulator()
          Instantiates a new simulator.
 
Method Summary
 void addListener(SimulatorListener listener)
          Adds the listener.
 void createSimulator(org.rakiura.cpn.Net net, PetriNet pn)
          Creates the simulator.
 java.util.List<SimulatorListener> getListener()
          Gets the listener.
 int getSleepTime()
          Gets the sleep time.
 void removeListener(SimulatorListener listener)
          Removes the listener.
 void runSimulation(de.ipk_gatersleben.ag_nw.graffiti.services.task.BackgroundTaskStatusProviderSupportingExternalCallImpl status)
          Runs the simulation for the defined steps and paused the simulation for the defined sleep time.
 void setSleepTime(int sleepTime)
          Sets the sleep time.
 void setSteps(int steps)
          Sets the steps. 0 = infinity steps
 void stop()
          Stops the simulation and calls all registered listener (step(true) = last step).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Simulator

public Simulator()
Instantiates a new simulator.

Method Detail

createSimulator

public void createSimulator(org.rakiura.cpn.Net net,
                            PetriNet pn)
Creates the simulator.

Parameters:
net - the net

stop

public void stop()
Stops the simulation and calls all registered listener (step(true) = last step).


runSimulation

public void runSimulation(de.ipk_gatersleben.ag_nw.graffiti.services.task.BackgroundTaskStatusProviderSupportingExternalCallImpl status)
Runs the simulation for the defined steps and paused the simulation for the defined sleep time. If no more transitions are enabled the simulations stops automatically.

Parameters:
status - the status

setSteps

public void setSteps(int steps)
Sets the steps. 0 = infinity steps

Parameters:
steps - the new steps

addListener

public void addListener(SimulatorListener listener)
Adds the listener.

Parameters:
listener - the listener

removeListener

public void removeListener(SimulatorListener listener)
Removes the listener.

Parameters:
listener - the listener

getListener

public java.util.List<SimulatorListener> getListener()
Gets the listener.

Returns:
the listener

getSleepTime

public int getSleepTime()
Gets the sleep time.

Returns:
the sleep time

setSleepTime

public void setSleepTime(int sleepTime)
Sets the sleep time.

Parameters:
sleepTime - the new sleep time