Class AbstractQueue<E>

java.lang.Object
  extended by AbstractQueue<E>
All Implemented Interfaces:
Queue<E>
Direct Known Subclasses:
ArrayQueue, LinkedListQueue

public abstract class AbstractQueue<E>
extends Object
implements Queue<E>

Class to define an abstract queue

Author:
Barb Ericson

Constructor Summary
AbstractQueue()
           
 
Method Summary
 boolean isEmpty()
          Method to see if the queue is empty
abstract  E peek()
          Peek at, but don't remove, the head of the queue
abstract  E pop()
          Pop an object from the Queue
abstract  void push(E element)
          Push an object onto the Queue
abstract  int size()
          Return the size of a queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractQueue

public AbstractQueue()
Method Detail

push

public abstract void push(E element)
Push an object onto the Queue

Specified by:
push in interface Queue<E>
Parameters:
element - the element to add to the queue

peek

public abstract E peek()
Peek at, but don't remove, the head of the queue

Specified by:
peek in interface Queue<E>
Returns:
the head of the queue (top)

pop

public abstract E pop()
Pop an object from the Queue

Specified by:
pop in interface Queue<E>
Returns:
the head (top) of the queue and remove it from the queue

size

public abstract int size()
Return the size of a queue

Specified by:
size in interface Queue<E>
Returns:
the number of elements in the queue

isEmpty

public boolean isEmpty()
Method to see if the queue is empty

Specified by:
isEmpty in interface Queue<E>
Returns:
true if the queue is empty, else false