hypercast.adapters
Class TimerEventQueue

java.lang.Object
  |
  +--hypercast.adapters.TimerEventQueue

public class TimerEventQueue
extends java.lang.Object

This class is for storing a set of yet-to-be-processed TimerEvents

Implementation:
The queue is stored in a Java Vector - the element with the highest time is at index 0, the lowest time is at index the_queue.size()-1.


Constructor Summary
TimerEventQueue()
          Constructs a TimeEventQueue object
 
Method Summary
 hypercast.adapters.TimerEvent getEvent(java.lang.Object id)
          Removes a specified time event from the queue.
 long getMinEventTime()
          Gets the time event with the minimum time
 java.util.Enumeration getPendingEvents()
          Returns all the pending time event int queue.
 void insert(hypercast.adapters.TimerEvent te)
          Inserts a time event at a random valid location with the current time at top, future events below.
 boolean isEmpty()
          Checks if the time event queue is empty.
 boolean isPendingEvent(hypercast.adapters.TimerEvent se)
          Check if the queue contains a specified time event.
 hypercast.adapters.TimerEvent remove(java.lang.Object id)
          Removes a specified time event from the queue.
 void remove(hypercast.adapters.TimerEvent te)
          Removes a specified time event from the queue.
 void removeEvents(java.util.Enumeration e)
          Removes all the time events in the queue.
 hypercast.adapters.TimerEvent removeTop()
          Removes the top time event in the queue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerEventQueue

public TimerEventQueue()
Constructs a TimeEventQueue object

Method Detail

getMinEventTime

public final long getMinEventTime()
Gets the time event with the minimum time

Returns:
a TimeEvent

getEvent

public final hypercast.adapters.TimerEvent getEvent(java.lang.Object id)
Removes a specified time event from the queue.

Parameters:
id - the id of the time event that to be removed

removeTop

public final hypercast.adapters.TimerEvent removeTop()
Removes the top time event in the queue

Returns:
last TimeEvent in the queue

insert

public final void insert(hypercast.adapters.TimerEvent te)
Inserts a time event at a random valid location with the current time at top, future events below.


remove

public final void remove(hypercast.adapters.TimerEvent te)
Removes a specified time event from the queue.

Parameters:
te - the time event that to be removed

remove

public final hypercast.adapters.TimerEvent remove(java.lang.Object id)
Removes a specified time event from the queue.

Parameters:
id - the id of the time event that to be removed

removeEvents

public final void removeEvents(java.util.Enumeration e)
Removes all the time events in the queue.


isEmpty

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

Returns:
true if the queue is empty, false otherwise

isPendingEvent

public final boolean isPendingEvent(hypercast.adapters.TimerEvent se)
Check if the queue contains a specified time event.

Returns:
true if the queue is empty, false otherwise

getPendingEvents

public final java.util.Enumeration getPendingEvents()
Returns all the pending time event int queue.