Class SortedEventQueue

java.lang.Object
  extended by SortedEventQueue

public class SortedEventQueue
extends java.lang.Object

   
 This is a list of Events which should kept sorted by the time at which they are to be invoked.
 


Constructor Summary
SortedEventQueue()
          Create a new empty event queue.
 
Method Summary
 void addEvent(Event event)
          Add an event to the queue in a sorted manner.
 Event getNextEvent()
          Return the next Event to happen without removing it from the queue.
 boolean isEmpty()
          Checks if the event queue is empty
 Event removeNextEvent()
          Remove the next Event to happen and remove it from the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SortedEventQueue

public SortedEventQueue()
Create a new empty event queue.

Method Detail

addEvent

public void addEvent(Event event)
Add an event to the queue in a sorted manner.

Parameters:
event - The event to add to the queue.

getNextEvent

public Event getNextEvent()
Return the next Event to happen without removing it from the queue.

Returns:
The next Event to happen. Returns null if the queue is empty

removeNextEvent

public Event removeNextEvent()
Remove the next Event to happen and remove it from the queue.

Returns:
The next Event to happen. Returns null if the queue is empty

isEmpty

public boolean isEmpty()
Checks if the event queue is empty

Returns:
True if the event queue is empty