| |
|
| java.lang.Object edu.hws.jcm.data.StackOfDouble
StackOfDouble | public class StackOfDouble implements java.io.Serializable(Code) | | A standard stack of values of type double, which can grow to arbitrary size.
|
Constructor Summary | |
public | StackOfDouble() Create an initially empty stack. | public | StackOfDouble(int initialSize) Create an empty stack that initially has space for initialSize items pre-allocated. |
Method Summary | |
public boolean | isEmpty() Return true if and only if the stack contains no items. | public void | makeEmpty() Clear all items from the stack. | public double | pop() Remove and return the top item on the stack. | public void | push(double x) Add x to top of stack. | public int | size() Return the number of items on the stack. |
StackOfDouble | public StackOfDouble()(Code) | | Create an initially empty stack. It initially has space allocated for one item.
|
StackOfDouble | public StackOfDouble(int initialSize)(Code) | | Create an empty stack that initially has space for initialSize items pre-allocated.
If initialSize <= 0, an initialSize of 1 is used.
|
isEmpty | public boolean isEmpty()(Code) | | Return true if and only if the stack contains no items.
|
makeEmpty | public void makeEmpty()(Code) | | Clear all items from the stack.
|
pop | public double pop()(Code) | | Remove and return the top item on the stack.
Will throw an exception of type java.util.EmptyStackException
if the stack is empty when pop() is called.
|
push | public void push(double x)(Code) | | Add x to top of stack.
|
size | public int size()(Code) | | Return the number of items on the stack.
|
|
|
|