Opus5
Interface Stack
- All Superinterfaces:
- Comparable, Container
- All Known Implementing Classes:
- StackAsArray, StackAsLinkedList
- public interface Stack
- extends Container
Encapsulates methods common to all stacks.
- Version:
- $Id: Stack.java,v 3.2 1998/07/28 03:09:15 brpreiss Exp $
- Author:
- Bruno R. Preiss, P.Eng.
|
Field Summary |
static java.lang.String |
copyright
|
|
Method Summary |
java.lang.Object |
getTop()
Returns the object found at the top of this stack. |
java.lang.Object |
pop()
Pops and returns the object found at the top of this stack. |
void |
push(java.lang.Object object)
Pushes the specified object on to the top of this stack. |
copyright
public static final java.lang.String copyright
getTop
public java.lang.Object getTop()
- Returns the object found at the top of this stack.
- Returns:
- The object found at the top of this stack.
- Throws:
ContainerEmptyException - If the stack is empty.
push
public void push(java.lang.Object object)
- Pushes the specified object on to the top of this stack.
- Parameters:
object - The object to be pushed onto this stack.- Throws:
ContainerFullException - If this stack is full.
pop
public java.lang.Object pop()
- Pops and returns the object found at the top of this stack.
- Returns:
- The object found at the top of this stack.
- Throws:
ContainerEmptyException - If the stack is empty.