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