csc241.samples.Queue
Interface Queue

All Known Implementing Classes:
dynamicQueue, fixedQueue

public interface Queue

~mohammad/public_html/classes/csc241/Queue/Queue.java This is an ADT for Queue class. A Queue holds objects. There is no code, private variables, or constructors designed for Queue as it is an Interface. We are postponing its implementation, so that we could have an array version and a linked list version. Notice that there is no constructor and instead of {} for the methods with simply have ';'.


Method Summary
 void dequeue()
          remove an element from the front of the queue.
 boolean empty()
          return true if queue is empty, otherwise, return false
 void enqueue(java.lang.Object x)
          add an element to the back of the queue.
 boolean full()
          return true if queue is full, otherwise, return false
 java.lang.Object peek()
          return value - the object in front of the queue; null if queue is empty.
 

Method Detail

empty

public boolean empty()
return true if queue is empty, otherwise, return false


full

public boolean full()
return true if queue is full, otherwise, return false


enqueue

public void enqueue(java.lang.Object x)
             throws queueException
add an element to the back of the queue.
x - the Object to be added

Throws:
- - queueException if queue is full
queueException

dequeue

public void dequeue()
             throws queueException
remove an element from the front of the queue.

Throws:
- - queueException if queue is empty.
queueException

peek

public java.lang.Object peek()
return value - the object in front of the queue; null if queue is empty.