|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.labs.minion.util.Stack
public class Stack
A stack of Java objects.
| Field Summary | |
|---|---|
protected int |
N
The number of elements in the stack. |
protected java.lang.Object[] |
stack
An array to store the objects in. |
| Constructor Summary | |
|---|---|
Stack()
Build a default-sized stack. |
|
Stack(int n)
Build a stack with a given number of elements available. |
|
Stack(Stack s)
Build a stack from another stack. |
|
| Method Summary | |
|---|---|
boolean |
empty()
Test whether this Stack is empty. |
protected void |
ensureCapacity(int n)
Ensure that there is enough room in the stack for the given number of elements. |
java.lang.Object |
peek()
Peek at the top of the stack, but don't return it. |
java.lang.Object |
pop()
Pop the top element off the stack. |
void |
push(java.lang.Object o)
Push an element onto the stack. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Object[] stack
protected int N
| Constructor Detail |
|---|
public Stack()
public Stack(int n)
public Stack(Stack s)
| Method Detail |
|---|
protected void ensureCapacity(int n)
n - The number of elements we want to store.public boolean empty()
public void push(java.lang.Object o)
o - the Object to push.public java.lang.Object peek()
public java.lang.Object pop()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||