gps.event
Class SimEventScheduler

java.lang.Object
  extended by gps.event.SimEventScheduler

public final class SimEventScheduler
extends java.lang.Object

Discrete event driver. It maintains an event queue for events to be triggered; provides functions for adding and canceling events; also maintains current virtual time.

Version:
1.2, 6/20/2005
Author:
Weishuai Yang

Method Summary
 boolean cancel(SimEvent e)
          cancels a scheduled event, and remove it from the queue
 SimEvent dequeue()
          gets a most prioriety SimEvent from the heap queue.
 void discharge()
          empties the event queue, logs discharged events in event log
 boolean enqueue(SimEvent e)
          adds a SimEvent to the event queue
 double getCurrent()
          gets current virtual time in simulation.
static java.util.logging.Logger getEventLog()
          gets event log
static SimEventScheduler getInstance()
          gets scheduler singleton instance
static void main(java.lang.String[] args)
          for test purpose
 void reset()
          empties the event queue without log, and reset current time to 0.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEventLog

public static java.util.logging.Logger getEventLog()
gets event log


enqueue

public boolean enqueue(SimEvent e)
adds a SimEvent to the event queue

Parameters:
e - the new event to be added to the queue

dequeue

public SimEvent dequeue()
gets a most prioriety SimEvent from the heap queue.

Returns:
event on the head of the queue, null if no events in the queue

cancel

public boolean cancel(SimEvent e)
cancels a scheduled event, and remove it from the queue

Parameters:
e - event to be canceled

getCurrent

public double getCurrent()
gets current virtual time in simulation.

Returns:
current virtual time

getInstance

public static SimEventScheduler getInstance()
gets scheduler singleton instance

Returns:
singleton instance

discharge

public void discharge()
empties the event queue, logs discharged events in event log


reset

public void reset()
empties the event queue without log, and reset current time to 0.


main

public static void main(java.lang.String[] args)
for test purpose

Parameters:
args - inputs