org.npsnet.xrti
Class TimeStampQueue

java.lang.Object
  extended byorg.npsnet.xrti.TimeStampQueue

public class TimeStampQueue
extends java.lang.Object

TimeStampQueue represents priority time stamp queue for time stamp order (TSO) messages. Timestamp messages are sorted by the time value.

Author:
Stanislav Kozina
See Also:
HLAMessage

Field Summary
private  java.util.LinkedList list
          List used as a queue for time stamp messages.
 
Constructor Summary
TimeStampQueue()
          Creates an instance of TimeStampQueue.
 
Method Summary
 HLAMessage dequeue()
          Dequeues and returns first message in queue or null if the queue is epmty.
 void enqueue(HLAMessage message)
          Enqueues specified message into the queue.
 LogicalTime getHeadTimeStamp()
          Returns time stamp of first message in the queue or null if the queue is epmty.
 int getLength()
          Returns the length of the queue.
 boolean isEmpty()
          Returns true if the queue is empty, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

private java.util.LinkedList list
List used as a queue for time stamp messages. The list is sorted after every insertion.

Constructor Detail

TimeStampQueue

public TimeStampQueue()
Creates an instance of TimeStampQueue. You should never need to create an instance of this class.

Method Detail

isEmpty

public boolean isEmpty()
Returns true if the queue is empty, false otherwise.

Returns:
true if the queue is empty, false otherwise

enqueue

public void enqueue(HLAMessage message)
Enqueues specified message into the queue.

Parameters:
message - message to enqueue

dequeue

public HLAMessage dequeue()
Dequeues and returns first message in queue or null if the queue is epmty.

Returns:
first message in queue or null if the queue is epmty

getHeadTimeStamp

public LogicalTime getHeadTimeStamp()
Returns time stamp of first message in the queue or null if the queue is epmty.

Returns:
time stamp of first message in the queue or null if the queue is epmty

getLength

public int getLength()
Returns the length of the queue.

Returns:
the length of the queue