EDU.ksu.cis.calculator
Class Deque

java.lang.Object
  |
  +--EDU.ksu.cis.calculator.Deque

public class Deque
extends Object

A double-ended queue which grows as needed.

Author:
Rod Howell (howell@cis.ksu.edu)

Constructor Summary
Deque()
           
 
Method Summary
 void addToBack(Object o)
          Inserts the given Object at the back of the Deque.
 void addToFront(Object o)
          Inserts the given Object at the front of the Deque.
 Object getBack()
          Returns the Object at the back of the Deque.
 Object getFront()
          Returns the Object at the front of the Deque.
 int getSize()
          Returns the number of elements in the Deque.
 boolean isEmpty()
          Returns true iff the Deque is empty.
 Object removeFromBack()
          Removes the Object at the back of the Deque and returns it.
 Object removeFromFront()
          Removes the Object at the front of the Deque and returns it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Deque

public Deque()
Method Detail

isEmpty

public boolean isEmpty()
Returns true iff the Deque is empty.


getSize

public int getSize()
Returns the number of elements in the Deque.


addToBack

public void addToBack(Object o)
Inserts the given Object at the back of the Deque.


addToFront

public void addToFront(Object o)
Inserts the given Object at the front of the Deque.


getFront

public Object getFront()
                throws EmptyDequeException
Returns the Object at the front of the Deque.

Throws:
EmptyDequeException - If the Deque is empty.

getBack

public Object getBack()
               throws EmptyDequeException
Returns the Object at the back of the Deque.

Throws:
EmptyDequeException - If the Deque is empty.

removeFromFront

public Object removeFromFront()
                       throws EmptyDequeException
Removes the Object at the front of the Deque and returns it.

Throws:
EmptyDequeException - If the Deque is empty.

removeFromBack

public Object removeFromBack()
                      throws EmptyDequeException
Removes the Object at the back of the Deque and returns it.

Throws:
EmptyDequeException - If the Deque is empty.