weiss.nonstandard
Class ArrayQueue

java.lang.Object
  |
  +--weiss.nonstandard.ArrayQueue
All Implemented Interfaces:
Queue

public class ArrayQueue
extends java.lang.Object
implements Queue

Array-based implementation of the queue.


Constructor Summary
ArrayQueue()
          Construct the queue.
 
Method Summary
 java.lang.Object dequeue()
          Return and remove the least recently inserted item from the queue.
 void enqueue(java.lang.Object x)
          Insert a new item into the queue.
 java.lang.Object getFront()
          Get the least recently inserted item in the queue.
 boolean isEmpty()
          Test if the queue is logically empty.
 void makeEmpty()
          Make the queue logically empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayQueue

public ArrayQueue()
Construct the queue.
Method Detail

isEmpty

public boolean isEmpty()
Test if the queue is logically empty.
Specified by:
isEmpty in interface Queue
Returns:
true if empty, false otherwise.

makeEmpty

public void makeEmpty()
Make the queue logically empty.
Specified by:
makeEmpty in interface Queue

dequeue

public java.lang.Object dequeue()
Return and remove the least recently inserted item from the queue.
Specified by:
dequeue in interface Queue
Returns:
the least recently inserted item in the queue.
Throws:
UnderflowException - if the queue is empty.

getFront

public java.lang.Object getFront()
Get the least recently inserted item in the queue. Does not alter the queue.
Specified by:
getFront in interface Queue
Returns:
the least recently inserted item in the queue.
Throws:
UnderflowException - if the queue is empty.

enqueue

public void enqueue(java.lang.Object x)
Insert a new item into the queue.
Specified by:
enqueue in interface Queue
Parameters:
x - the item to insert.