edu.colorado.cs.ns2.animation
Class EventQueue

java.lang.Object
  extended by edu.colorado.cs.ns2.animation.EventQueue
All Implemented Interfaces:
TraceEventQueue

public class EventQueue
extends java.lang.Object
implements TraceEventQueue

A Queue ADT implementation to store simulation events parsed from the NS2 trace file.

Author:
Kevin Bauer, Pushkar Sambhoos.

Field Summary
private  TraceEventNode head
          References to the head and tail of the Queue.
private  long size
          Stores the current Queue size.
private  TraceEventNode tail
          References to the head and tail of the Queue.
 
Constructor Summary
EventQueue()
          Default constructor.
 
Method Summary
 TraceEvent dequeue()
          Removes a trace event from the head of the Queue.
 void enqueue(TraceEvent event)
          Inserts a new trace event at the tail of the Queue.
 TraceEvent getFirst()
          Returns a reference to the head of the Queue.
 TraceEvent getLast()
          Returns a reference to the tail of the Queue.
 boolean isEmpty()
          Returns True if the Queue is empty.
 long size()
          Returns the size of the Queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

head

private TraceEventNode head
References to the head and tail of the Queue.


tail

private TraceEventNode tail
References to the head and tail of the Queue.


size

private long size
Stores the current Queue size.

Constructor Detail

EventQueue

public EventQueue()
Default constructor.

Method Detail

dequeue

public TraceEvent dequeue()
Removes a trace event from the head of the Queue.

Specified by:
dequeue in interface TraceEventQueue

enqueue

public void enqueue(TraceEvent event)
Inserts a new trace event at the tail of the Queue.

Specified by:
enqueue in interface TraceEventQueue

size

public long size()
Returns the size of the Queue.

Specified by:
size in interface TraceEventQueue
Returns:
The size of the Queue.

getFirst

public TraceEvent getFirst()
Returns a reference to the head of the Queue.

Specified by:
getFirst in interface TraceEventQueue

getLast

public TraceEvent getLast()
Returns a reference to the tail of the Queue.

Specified by:
getLast in interface TraceEventQueue

isEmpty

public boolean isEmpty()
Returns True if the Queue is empty.

Specified by:
isEmpty in interface TraceEventQueue