Source of DequeInterface.java


  1: /**
  2:    An interface for the ADT deque.
  3:    @author Frank M. Carrano
  4:    @author Timothy M. Henry
  5:    @version 4.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 operation. */
 17:    public T removeFront();
 18:    public T removeBack();
 19:    
 20:    /** Retrieves the front/back entry of this deque.
 21:     @return  The object at the front/back of the deque.
 22:     @throws  EmptyQueueException if the deque is empty. */
 23:    public T getFront();
 24:    public T getBack();
 25:    
 26:    /** Detects whether this deque is empty.
 27:        @return  True if the deque is empty, or false otherwise. */
 28:    public boolean isEmpty();
 29:    
 30:    /*  Removes all entries from this deque. */
 31:    public void clear();
 32: } // end DequeInterface