All Packages Class Hierarchy This Package Previous Next Index
Interface DataStructures.Stack
- public abstract interface Stack
Protocol for stacks.
-
isEmpty()
- Test if the stack is logically empty.
-
makeEmpty()
- Make the stack logically empty.
-
pop()
- Remove the most recently inserted item from the stack.
-
push(Object)
- Insert a new item into the stack.
-
top()
- Get the most recently inserted item in the stack.
-
topAndPop()
- Return and remove the most recently inserted item
from the stack.
isEmpty
public abstract boolean isEmpty()
- Test if the stack is logically empty.
- Returns:
- true if empty, false otherwise.
top
public abstract java.lang.Object top() throws Exceptions.Underflow
- Get the most recently inserted item in the stack.
Does not alter the stack.
- Returns:
- the most recently inserted item in the stack.
- Throws: Underflow
- if the stack is empty.
pop
public abstract void pop() throws Exceptions.Underflow
- Remove the most recently inserted item from the stack.
- Throws: Underflow
- if the stack is empty.
topAndPop
public abstract java.lang.Object topAndPop() throws Exceptions.Underflow
- Return and remove the most recently inserted item
from the stack.
- Returns:
- the most recently inserted item in the stack.
- Throws: Underflow
- if the stack is empty.
push
public abstract void push(java.lang.Object x)
- Insert a new item into the stack.
- Parameters:
- x - the item to insert.
makeEmpty
public abstract void makeEmpty()
- Make the stack logically empty.
All Packages Class Hierarchy This Package Previous Next Index