com.cogent
Class SimDispatchElement

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.cogent.SimElement
              |
              +--com.cogent.SimDispatchElement
All Implemented Interfaces:
java.lang.Runnable

public class SimDispatchElement
extends SimElement

The dispatcher.


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static SimDispatchElement getInstance()
           
 void postEvent(SimEvent argEvent, long argTime)
          Callback from Processing elements to add events to the event queue.
 void run()
          While there are no events to process, wait.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

postEvent

public void postEvent(SimEvent argEvent,
                      long argTime)
Callback from Processing elements to add events to the event queue.

Parameters:
argEvent - A SimEvent to add to the queue
argTime - A priority for the event (time)

getInstance

public static SimDispatchElement getInstance()
Returns:
the one and only instance of the dispatcher

run

public void run()
While there are no events to process, wait. When there are events, process all at the next priority level, and then go back to sleep.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread