1: /**
2: An interface for the ADT stack.
3: @author Frank M. Carrano
4: @author Timothy M. Henry
5: @version 5.0
6: */
7: public interface StackInterface<T>
8: {
9: /** Adds a new entry to the top of this stack.
10: @param newEntry An object to be added to the stack. */
11: public void push(T newEntry);
12:
13: /** Removes and returns this stack's top entry.
14: @return The object at the top of the stack.
15: @throws EmptyStackException if the stack is empty before the operation. */
16: public T pop();
17:
18: /** Retrieves this stack's top entry.
19: @return The object at the top of the stack.
20: @throws EmptyStackException if the stack is empty. */
21: public T peek();
22:
23: /** Detects whether this stack is empty.
24: @return True if the stack is empty. */
25: public boolean isEmpty();
26:
27: /** Removes all entries from this stack. */
28: public void clear();
29: } // end StackInterface