@ParametersAreNonnullByDefault public final class DefaultValueStack<V> extends ValueStackBase<V>
| Constructor and Description |
|---|
DefaultValueStack() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkIndex(int index) |
void |
clear()
Clears all values.
|
protected void |
doDup() |
protected V |
doPeek(int down)
Retrieves, witout removing, the value at the given stack indx
|
protected void |
doPoke(int down,
V value)
Replaces a value at a given stack index
|
protected V |
doPop(int down)
Removes the value from a given stack index
|
protected void |
doPush(int down,
V value)
Push a value onto the stack at the given index
|
protected void |
doSwap(int n)
Reverses the order of the top n stack values
|
boolean |
isEmpty()
Determines whether the stack is empty.
|
Iterator<V> |
iterator() |
void |
restoreSnapshot(Object snapshot)
Restores the stack state as previously returned by
ValueStack.takeSnapshot(). |
int |
size()
Returns the number of elements currently on the stack.
|
Object |
takeSnapshot()
Returns an object representing the current state of the stack.
|
String |
toString() |
public boolean isEmpty()
ValueStackpublic int size()
ValueStackpublic void clear()
ValueStack@Nonnull public Object takeSnapshot()
ValueStackpublic void restoreSnapshot(Object snapshot)
ValueStackValueStack.takeSnapshot().snapshot - a snapshot object previously returned by ValueStack.takeSnapshot()protected void doPush(int down,
V value)
ValueStackBaseThe value is guaranteed never to be null and the index is guaranteed to be valid.
doPush in class ValueStackBase<V>down - the indexvalue - the value@Nonnull protected V doPop(int down)
ValueStackBaseThe index is guaranteed to be valid.
doPop in class ValueStackBase<V>down - the index@Nonnull protected V doPeek(int down)
ValueStackBaseThe index is guaranteed to be valid.
doPeek in class ValueStackBase<V>down - the indexprotected void doPoke(int down,
V value)
ValueStackBaseThe index is guaranteed to be valid and the value is guaranteed not to be null.
doPoke in class ValueStackBase<V>down - the indexvalue - the valueprotected void doDup()
doDup in class ValueStackBase<V>protected void doSwap(int n)
ValueStackBaseThe number of values is guaranteed to be valid.
doSwap in class ValueStackBase<V>n - the number of values to swapprotected void checkIndex(int index)
checkIndex in class ValueStackBase<V>