Our Test Candidate

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]

ArrayedStack.java
public class ArrayedStack {
   /**
    * Create a stack with the given capacity
    * @param    capacity    maximum number of objects that
    */
   public ArrayedStack(int capacity) {}

   /**
    * Test a stack for being empty.
    * @return   true if the stack is empty.
    */
   public boolean empty() { return false; }

   /**
    * Test a stack for being full.
    * @return   true if the stack is full.
    */
   public boolean full() { return false; }

   /**
    * Store an object onto the stack.
    * Precondition: Stack must not be full.
    * @param object  object to be stored onto the stack.
    */
   public void push(Object object) {}

   /**
    * Fetch and remove the top-most object from the stack.
    * Precondition: Stack must not be empty.
    * @return   the top-most object.
    */
   public Object pop() { return null; }
}

 [Previous Chapter]  [Previous Page]  [Contents]  [Next Page]  [Next Chapter]
Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002