umontreal.iro.lecuyer.simprocs
Class ThreadProcessSimulator
- java.lang.Object
-
- umontreal.iro.lecuyer.simevents.Simulator
-
- umontreal.iro.lecuyer.simprocs.ProcessSimulator
-
- umontreal.iro.lecuyer.simprocs.ThreadProcessSimulator
-
public class ThreadProcessSimulator extends ProcessSimulator
Represents a process simulator using Java threads for process synchronization. The simulation process threads are synchronized so only one process runs at a time.
-
-
Field Summary
-
Fields inherited from class umontreal.iro.lecuyer.simevents.Simulator
defaultSimulator
-
-
Constructor Summary
Constructors Constructor and Description ThreadProcessSimulator()Creates a newThreadProcessSimulatorvariable.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description umontreal.iro.lecuyer.simprocs.SimThreadcreateControlEvent(SimProcess process)Constructs and returns a newEventobject used for synchronization.voiddelay(SimProcess process, double delay)Suspends the execution of process and schedules it to resume its execution in delay units of simulation time.voidinit()voidinit(EventList evlist)Initializes the thread process-driven simulation using evlist variable asEventList.voidkill(SimProcess process)Terminates the life of process and sets its state to DEAD, after canceling its control event if there is one.voidkillAll()Kills all threads linked to the current variable.voidsuspend(SimProcess process)Suspends process.-
Methods inherited from class umontreal.iro.lecuyer.simprocs.ProcessSimulator
currentProcess, initDefault, newInstance
-
Methods inherited from class umontreal.iro.lecuyer.simevents.Simulator
continuousState, getDefaultSimulator, getEventList, isSimulating, isStopped, start, stop, time
-
-
-
-
Constructor Detail
-
ThreadProcessSimulator
public ThreadProcessSimulator()
Creates a newThreadProcessSimulatorvariable.
-
-
Method Detail
-
init
public void init()
-
init
public void init(EventList evlist)
Initializes the thread process-driven simulation using evlist variable asEventList. This kills all processes already associated with the current variable.
-
createControlEvent
public umontreal.iro.lecuyer.simprocs.SimThread createControlEvent(SimProcess process)
Description copied from class:ProcessSimulatorConstructs and returns a newEventobject used for synchronization. Such control events are used by process simulator to start a process or to resume it if it is already started.- Specified by:
createControlEventin classProcessSimulator
-
delay
public void delay(SimProcess process, double delay)
Description copied from class:ProcessSimulatorSuspends the execution of process and schedules it to resume its execution in delay units of simulation time. The state of the process also changes to DELAYED.- Specified by:
delayin classProcessSimulator- Parameters:
process- SimProcess variable to delay.delay- delay value, in simulation time units.
-
suspend
public void suspend(SimProcess process)
Description copied from class:ProcessSimulatorSuspends process. If the process is EXECUTING, this suspends its execution. If the process is DELAYED, this cancels its control event. This method also places the process in the SUSPENDED state.- Specified by:
suspendin classProcessSimulator- Parameters:
process- SimProcess variable to suspend.
-
kill
public void kill(SimProcess process)
Description copied from class:ProcessSimulatorTerminates the life of process and sets its state to DEAD, after canceling its control event if there is one.- Specified by:
killin classProcessSimulator
-
killAll
public void killAll()
Kills all threads linked to the current variable.- Specified by:
killAllin classProcessSimulator
-
-
DMelt 3.0 © DataMelt by jWork.ORG