avrora.sim.util
Class GlobalClock.LocalMeet
java.lang.Object
avrora.sim.util.GlobalClock.LocalMeet
- All Implemented Interfaces:
- Simulator.Event
- Direct Known Subclasses:
- GlobalClock.Ticker, SimpleAir.DeliveryMeet
- Enclosing class:
- GlobalClock
- public abstract static class GlobalClock.LocalMeet
- extends java.lang.Object
- implements Simulator.Event
Field Summary |
protected java.lang.Object |
condition
|
protected int |
count
|
protected int |
goal
|
protected java.lang.String |
id
|
Method Summary |
void |
decGoal()
|
void |
fire()
The fire() method of this event is called by the individual event queues of each
simulator as they reach this point in time. |
abstract void |
parallelAction(SimulatorThread st)
The parallelAction() method implements the functionality that must be performed in
parallel when the threads have joined at this local meet, and after the serial action has been
completed. |
abstract void |
preSynchAction()
The preSynchAction() method implements the functionality that must be performed just
after the thread enters the local meet, but before it blocks waiting for the other threads. |
abstract void |
serialAction()
The serialAction() method implements the functionality that must be performed in
serial when the threads have joined at this local meet. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
id
protected final java.lang.String id
condition
protected final java.lang.Object condition
goal
protected int goal
count
protected int count
GlobalClock.LocalMeet
protected GlobalClock.LocalMeet(java.lang.String id)
fire
public void fire()
- The
fire()
method of this event is called by the individual event queues of each
simulator as they reach this point in time. The implementation of this method waits for all threads
to join. It will then execute the serialAction()
method in the last thread to join the
clock, and execute the parallelAction
in each of the threads, in parallel, and then
release the threads by returning back to the Simulator.
- Specified by:
fire
in interface Simulator.Event
decGoal
public void decGoal()
preSynchAction
public abstract void preSynchAction()
- The
preSynchAction()
method implements the functionality that must be performed just
after the thread enters the local meet, but before it blocks waiting for the other threads. It is
called with the condition
monitor held.
serialAction
public abstract void serialAction()
- The
serialAction()
method implements the functionality that must be performed in
serial when the threads have joined at this local meet. This method will execute in the last thread
to enter the fire() method.
parallelAction
public abstract void parallelAction(SimulatorThread st)
- The
parallelAction()
method implements the functionality that must be performed in
parallel when the threads have joined at this local meet, and after the serial action has been
completed. It will be called in each thread, with the parameter passed being the current
SimulatorThread.
- Parameters:
st
- the current SimulatorThread
instance for this thread