CITS2200
Interface Deque<E>


public interface Deque<E>

A Classs for basic operations of a double ended queue (DEQUE).


Method Summary
 boolean isEmpty()
           
 boolean isFull()
           
 E peekLeft()
          Returns the element on the left end of the queue.
 E peekRight()
          Returns the element on the right end of the queue.
 E popLeft()
          Removes and returns the element on the left end of the queue.
 E popRight()
          Removes and returns the element on the right end of the queue.
 void pushLeft(E element)
          Adds an element to the left end of the queue.
 void pushRight(E element)
          Adds an element to the right end of the queue.
 

Method Detail

pushLeft

void pushLeft(E element)
              throws Overflow
Adds an element to the left end of the queue.

Parameters:
element - the element to be added
Throws:
overflow - if the queue is full
Overflow

pushRight

void pushRight(E element)
               throws Overflow
Adds an element to the right end of the queue.

Parameters:
element - the element to be added
Throws:
overflow - if the queue is full
Overflow

popLeft

E popLeft()
          throws Underflow
Removes and returns the element on the left end of the queue.

Returns:
the leftmost element
Throws:
Underflow - if the queue is empty

popRight

E popRight()
           throws Underflow
Removes and returns the element on the right end of the queue.

Returns:
the rightmost element
Throws:
Underflow - if the queue is empty

peekRight

E peekRight()
            throws Underflow
Returns the element on the right end of the queue.

Returns:
the rightmost element
Throws:
Underflow - if the queue is empty

peekLeft

E peekLeft()
           throws Underflow
Returns the element on the left end of the queue.

Returns:
the leftmost element
Throws:
Underflow - if the queue is empty

isEmpty

boolean isEmpty()
Returns:
true is the queue is empty

isFull

boolean isFull()
Returns:
true if the queue is full