All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.util.Observable | +----simula.simset.simulation.Simulation
update
call in observers.
protected Process currProcess
protected EventThread firstThread
protected EventThread lastThread
public Simulation()
public Simulation(Process _first)
public void activate(Process _process) throws SimulaException
public void activate_after(Process _P, Process _Q) throws SimulaException
public void activate_at(Process _process, double _time, boolean _prior) throws SimulaException
True consider the time like an exclusive bound.
Throws: SimulaException
Fired if the process is already active or the time is obsolete.
activate_before
public void activate_before(Process _P,
Process _Q) throws SimulaException
- Activates the first given process before the second one.
- Parameters:
- _P - Process to be activated.
- _Q - Process to be preceded.
- Throws: SimulaException
- Fired if already active or unable to activate.
activate_delay
public void activate_delay(Process _process,
double _delay,
boolean _prior) throws SimulaException
- Activates the given process at the given time from now.
- Parameters:
- _process - Process to be activated.
- _delay - Time of activation from now.
- _prior - If
True consider the time like an exclusive bound.
Throws: SimulaException
Fired if unable to activate.
cancel
public void cancel(Process _process) throws SimulaException
- Cancel the given process from the event list.
- Parameters:
- _process - Process to be cancelled.
- Throws: SimulaException
- There was an attempt to passivate the main process of the simulation.
current
public Process current()
- Returns the currently active process.
- Returns:
- the currently active process.
destroy
public void destroy() throws SimulaException
- Kills all sctive threads.
Can' t be called by a Proceess or a Mainprocess, because it while try to kill the active thread too.
should be used by a UI to kill all processes and MainProcess
If called from an applet it will trhow an exception; to avoid this install a security manager
- Throws: SimulaException
- If thre is problems while unscheduling processes.
dump
protected void dump()
- Debug function used to dump scheduling informations.
end
public void end() throws SimulaException
- Kills all sctive threads.
Can' t be called by a Proceess, because it while try to kill the active thread too.
It shold be called in the last instruction of
SimulationMain
, to ensure that
there are no zombi threads.
- Throws: SimulaException
- If thre is problems while unscheduling processes
finished
public boolean finished()
- Returns the simulation status. Not to be confused with the old
SimulationMonitor.finished()
This reads the status, does not set it.
- Returns:
- boolean True is one of metods
end() and
destroy()
has been called
hold
public void hold(double _time) throws SimulaException
- Suspends the currently active process for the given amount of time.
And notify it to observers.
- Parameters:
- _time - The amount of time to hold the main process of the simulation.
- Throws: SimulaException
- There is no active process in the simulation.
passivate
public void passivate() throws SimulaException
- Passivate the currently active process.
And notify it to observers.
- Throws: SimulaException
- There was an attempt to passivate the main process of the simulation.
reactivate
public void reactivate(Process _process) throws SimulaException
- Reactivate immediately the given process.
And notify it to observers.
- Parameters:
- _process - Process to be reactivated.
- Throws: SimulaException
- Fired if unable to cancel or activate the process.
reactivate_after
public void reactivate_after(Process _P,
Process _Q) throws SimulaException
- Reactivates the first given process after the second one.
- Parameters:
- _P - Process to be activated.
- _Q - Process to be preceded.
- Throws: SimulaException
- Fired if already active or unable to reactivate.
reactivate_at
public void reactivate_at(Process _process,
double _time,
boolean _prior) throws SimulaException
- Reactivate the given process at the given time.
- Parameters:
- _process - Process to be reactivated.
- _time - Wanted time of activation.
- _prior - If
True consider the time like an exclusive bound.
Throws: SimulaException
Fired if unable to cancel or activate the process.
reactivate_before
public void reactivate_before(Process _P,
Process _Q) throws SimulaException
- Reactivates the first given process before the second one.
- Parameters:
- _P - Process to be activated.
- _Q - Process to be preceded.
- Throws: SimulaException
- Fired if already active or unable to reactivate.
reactivate_delay
public void reactivate_delay(Process _process,
double _delay,
boolean _prior) throws SimulaException
- Reactivate the given process at the given time from now.
- Parameters:
- _process - Process to be reactivated.
- _delay - Time of activation from now.
- _prior - If
True consider the time like an exclusive bound.
Throws: SimulaException
Fired if unable to reactivate.
time
public double time() throws SimulaException
- Returns the time from the beginning of the simulation.
- Returns:
- the time from the beginning of the simulation.
- Throws: SimulaException
- If there is no process currently active.
update
public void update()
- Notify simulation status to observers (if there are any)
It is called when a process passivates or holds
The current active process is passed as parameter to the
update
call in observers.
Can be called by a Process
too, to force display update.
wait
public void wait(Head _list) throws SimulaException
- Adds the current process to the given waiting list and passivates it.
And notify it to observers.
- Parameters:
- _list - List where the current process will be added to.
- Throws: SimulaException
- Fired if unable to insert or passivate the current process.
All Packages Class Hierarchy This Package Previous Next Index