weiss.util
Class  Stack
java.lang.Object
  |
  +--weiss.util.Stack
- All Implemented Interfaces: 
 - java.io.Serializable
 
- public class Stack
- extends java.lang.Object
- implements java.io.Serializable
   
Stack class. Unlike java.util.Stack, this is not
 extended from Vector. This is the minimum respectable
 set of operations.
- See Also: 
 - Serialized Form
 
| 
Constructor Summary | 
Stack()
 
          Constructs an empty stack. | 
 
| 
Method Summary | 
 void | 
clear()
 
            | 
 boolean | 
isEmpty()
 
          Tests if stack is empty. | 
 java.lang.Object | 
peek()
 
          Returns item from the top of the stack. | 
 java.lang.Object | 
pop()
 
          Removes and returns item from the top of the stack. | 
 java.lang.Object | 
push(java.lang.Object x)
 
          Adds an item to the top of the stack. | 
 int | 
size()
 
          Returns the size of the stack. | 
 java.lang.String | 
toString()
 
            | 
 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
 
Stack
public Stack()
- Constructs an empty stack.
 
push
public java.lang.Object push(java.lang.Object x)
- Adds an item to the top of the stack.
 
- Parameters:
 x - the item to add.- Returns:
 - the item added.
 
 
 
pop
public java.lang.Object pop()
- Removes and returns item from the top of the stack.
 
- Returns:
 - the former top item.
 - Throws:
 EmptyStackException - if stack is empty.
 
 
peek
public java.lang.Object peek()
- Returns item from the top of the stack.
 
- Returns:
 - the top item.
 - Throws:
 EmptyStackException - if stack is empty.
 
 
isEmpty
public boolean isEmpty()
- Tests if stack is empty.
 
- Returns:
 - true if the stack is empty; false otherwise.
 
 
 
size
public int size()
- Returns the size of the stack.
 
- Returns:
 - the size of the stack.
 
 
 
clear
public void clear()
 
toString
public java.lang.String toString()
- Overrides:
 toString in class java.lang.Object