Source of DequeInterface.java


  1: /**
  2:    An interface for the ADT deque.
  3:    @author Frank M. Carrano
  4:    @author Timothy M. Henry
  5:    @version 5.0
  6: */
  7: public interface DequeInterface<T>
  8: {
  9:    /** Adds a new entry to the front/back of this deque.
 10:        @param newEntry  An object to be added. */
 11:    public void addToFront(T newEntry);
 12:    public void addToBack(T newEntry);
 13:    
 14:    /** Removes and returns the front/back entry of this deque.
 15:        @return  The object at the front/back of the deque.
 16:        @throws  EmptyQueueException if the deque is empty before the
 17:                 operation. */
 18:    public T removeFront();
 19:    public T removeBack();
 20:    
 21:    /** Retrieves the front/back entry of this deque.
 22:        @return  The object at the front/back of the deque.
 23:        @throws  EmptyQueueException if the deque is empty. */
 24:    public T getFront();
 25:    public T getBack();
 26:    
 27:    /** Detects whether this deque is empty.
 28:        @return  True if the deque is empty, or false otherwise. */
 29:    public boolean isEmpty();
 30:    
 31:    /*  Removes all entries from this deque. */
 32:    public void clear();
 33: } // end DequeInterface