|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tenua.symbol.DoubleStack
public class DoubleStack
A simple stack of doubles. Until autoboxing is implemented,
it's too hard to keep casting back and forth, using java.util.Stack.
Is NOT thread-safe.
Constructor Summary | |
---|---|
DoubleStack()
construct a new DoubleStack with initial capacity == 10. |
|
DoubleStack(int capacity)
construct a new DoubleStack with initial capacity == capacity. |
|
DoubleStack(Vec d)
construct a new DoubleStack with given initial values. |
Method Summary | |
---|---|
void |
clear()
clear the stack. |
java.lang.Object |
clone()
clones the stack |
Vec |
getValues()
return a copy of the numbers in the stack |
double |
peek()
return the top of the stack without removing it. |
double |
pop()
pop a value off the stack. |
void |
push(double d)
push a value onto the stack. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DoubleStack()
public DoubleStack(int capacity)
capacity
- the initial capacitypublic DoubleStack(Vec d)
d
- the values to load onto the stack. The top of the stack will be
d.get(d.size()-1); the bottom of the stack will be d.get(0);Method Detail |
---|
public void push(double d)
d
- the value to pushpublic double pop()
EmptyStackException
- if the stack is emptypublic double peek()
EmptyStackException
- if the stack is emptypublic void clear()
public Vec getValues()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |