V - type parameter of this stack's values@ParametersAreNonnullByDefault public abstract class ValueStackBase<V> extends Object implements ValueStack<V>
ValueStack| Constructor and Description |
|---|
ValueStackBase() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
checkIndex(int index) |
protected abstract void |
doDup() |
protected abstract V |
doPeek(int down)
Retrieves, witout removing, the value at the given stack indx
|
protected abstract void |
doPoke(int down,
V value)
Replaces a value at a given stack index
|
protected abstract V |
doPop(int down)
Removes the value from a given stack index
|
protected abstract void |
doPush(int down,
V value)
Push a value onto the stack at the given index
|
protected abstract void |
doSwap(int n)
Reverses the order of the top n stack values
|
void |
dup()
Duplicates the top value.
|
V |
peek()
Returns the value at the top of the stack without removing it.
|
V |
peek(int down)
Returns the value the given number of elements below the top of the stack
without removing it.
|
<T extends V> |
peekAs(Class<T> type)
Casts and returns the value at the top of the stack without removing it
|
<T extends V> |
peekAs(Class<T> type,
int down)
Casts and returns the value at a given index in the stack without
removing it
|
void |
poke(int down,
V value)
Replaces the element the given number of elements below the current top
of the stack.
|
void |
poke(V value)
Replaces the current top value with the given value.
|
V |
pop()
Removes the value at the top of the stack and returns it.
|
V |
pop(int down)
Removes the value the given number of elements below the top of the stack.
|
<T extends V> |
popAs(Class<T> type)
Removes and casts the value at the top of the stack, and returns it
|
<T extends V> |
popAs(Class<T> type,
int down)
Removes and casts the value at a given index in the stack, and returns it
|
void |
push(int down,
V value)
Inserts the given value a given number of elements below the current top
of the stack.
|
void |
push(V value)
Pushes the given value onto the stack.
|
void |
swap()
Swaps the top two stack values.
|
void |
swap(int n)
Reverses the order of the top n stack values
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, isEmpty, restoreSnapshot, size, takeSnapshotpublic final void push(V value)
ValueStackpush in interface ValueStack<V>value - the valuepublic final void push(int down,
V value)
ValueStackpush in interface ValueStack<V>down - the number of elements to skip before inserting the value (0
being equivalent to push(value))value - the valueprotected abstract void doPush(int down,
V value)
The value is guaranteed never to be null and the index is guaranteed to be valid.
down - the indexvalue - the value@Nonnull public final V pop()
ValueStackpop in interface ValueStack<V>@Nonnull public final V pop(int down)
ValueStackpop in interface ValueStack<V>down - the number of elements to skip before removing the value (0
being equivalent to pop())@Nonnull public final <T extends V> T popAs(Class<T> type)
ValueStackpopAs in interface ValueStack<V>T - type parametertype - the type to cast to@Nonnull public final <T extends V> T popAs(Class<T> type, int down)
ValueStackpopAs in interface ValueStack<V>T - type parametertype - the type to cast todown - the indexprotected abstract V doPop(int down)
The index is guaranteed to be valid.
down - the index@Nonnull public final V peek()
ValueStackpeek in interface ValueStack<V>@Nonnull public final V peek(int down)
ValueStackpeek in interface ValueStack<V>down - the number of elements to skip (0 being equivalent to peek())@Nonnull public final <T extends V> T peekAs(Class<T> type)
ValueStackpeekAs in interface ValueStack<V>T - type parametertype - the type to cast to@Nonnull public final <T extends V> T peekAs(Class<T> type, int down)
ValueStackpeekAs in interface ValueStack<V>T - type parametertype - the type to cast todown - the index in the stackprotected abstract V doPeek(int down)
The index is guaranteed to be valid.
down - the indexpublic final void poke(@Nonnull V value)
ValueStackpoke in interface ValueStack<V>value - the valuepublic final void poke(int down,
V value)
ValueStackpoke in interface ValueStack<V>down - the number of elements to skip before replacing the value (0
being equivalent to poke(value))value - the value to replace withprotected abstract void doPoke(int down,
V value)
The index is guaranteed to be valid and the value is guaranteed not to be null.
down - the indexvalue - the valuepublic final void swap(int n)
ValueStackswap in interface ValueStack<V>n - the number of elements to reversepublic final void swap()
ValueStackswap in interface ValueStack<V>public final void dup()
dup in interface ValueStack<V>protected abstract void doDup()
protected abstract void doSwap(int n)
The number of values is guaranteed to be valid.
n - the number of values to swapprotected abstract void checkIndex(int index)