/**
   The Deque interface specifies a collection of elements that are added
   and removed both at the beginning and the end of the double-ended queue.

   @author      Franck van Breugel
   @version     1.1    June 7, 2001
*/
public interface Deque 
{
    /** 
	Returns the size of this deque. 
	
	@return The size of this deque.
    */
    public int size();

    /** 
	Tests if this deque is empty. 
     
	@return true if this deque is empty, false otherwise.
    */
    public boolean isEmpty();

    /** 
	Returns the first element of this deque.

	@return The first element of this deque.
	@exception DequeEmptyException if this deque is empty. 
    */
    public Object first() throws DequeEmptyException;

    /** 
	Returns the last element of this deque.

	@return The last element of this deque.
	@exception DequeEmptyException if this deque is empty. 
    */
    public Object last() throws DequeEmptyException;

    /** 
	Adds the specified element at the beginning of this deque.
     
	@param element The element added to this deque. 
    */
    public void insertFirst(Object element);

    /** 
	Adds the specified element at the end of this deque.
     
	@param element The element added to this deque. 
    */
    public void insertLast(Object element);

    /** 
	Removes the first element of this deque and returns that element.

	@return The first element of this deque.
	@exception DequeEmptyException if this deque is empty. 
    */
    public Object removeFirst() throws DequeEmptyException;

    /** 
	Removes the last element of this deque and returns that element.

	@return The last element of this deque.
	@exception DequeException if this deque is empty. 
    */
    public Object removeLast() throws DequeEmptyException;
}    
