/**
 * A stack of Objects.
 *
 * @author Blanca Polo
 * @version 21 Oct 2003
 */

public interface Stack {

  /**
   * Determines whether or not the stack is empty.
   * 
   * @return true if there are no elements in the stack (size() == 0),
   *    otherwise returns false.
   */
  public boolean isEmpty();
   
  
  /**
   * Returns the size of the stack.
   *
   * @return the number of elements in the stack
   */
  public int size();
  
  
  /**
   * Pushes (adds) an element to the top of the stack
   * @param item   Object
   */
  public void push(Object item);


  /**
   * Pops (removes) an item from the top of the stack.
   * @return    the object removed from the stack
   * @throws StackException  if the object cannot be removed
   */
  public Object pop () throws StackException;


  /**
   * Returns the element at the top of the stack 
   *  (or null if there is no such element).
   * Does not remove the item or affect the stack in any way.
   */
  public Object peek ();


  /**
   * Removes all elements from the stack
   * and "prints" them as they are popped.
   * @return  a String of all the elements popped from the stack
   */
  public String popAndPrint () throws StackException;
  
  
  /**
   * Removes all elements from the stack
   * size() is then 0.
   */
  public void popAll ();

  
}//end interface

