Package jmri.jmrit.logixng
Interface Stack
- All Known Implementing Classes:
DefaultStack
public interface Stack
A table that is a stack
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionintgetCount()Get the number of items on the stackgetValueAndTypeAtIndex(int index) Get the value and type at an indexgetValueAtIndex(int index) Get the value at an indexpop()Pops the topmost value off the top of the stack so the stack shrinks.voidpush(Stack.ValueAndType value) Pushes a value on the top of the stack so the stack grow.voidsetCount(int newCount) Reset the number of items on the stack.voidsetValueAndTypeAtIndex(int index, Stack.ValueAndType valueAndType) Set the value at an indexvoidsetValueAtIndex(int index, Object value) Set the value at an index
-
Method Details
-
push
Pushes a value on the top of the stack so the stack grow.- Parameters:
value- the value to push to the stack
-
pop
Pops the topmost value off the top of the stack so the stack shrinks.- Returns:
- the value that is on the top of the stack
-
getValueAtIndex
Get the value at an index- Parameters:
index- the index from bottom of the table- Returns:
- value the new value
-
setValueAtIndex
Set the value at an index- Parameters:
index- the index from bottom of the tablevalue- the new value
-
getValueAndTypeAtIndex
Get the value and type at an index- Parameters:
index- the index from bottom of the table- Returns:
- value and type the new value
-
setValueAndTypeAtIndex
Set the value at an index- Parameters:
index- the index from bottom of the tablevalueAndType- the new value and type
-
getCount
int getCount()Get the number of items on the stack- Returns:
- the number of items
-
setCount
Reset the number of items on the stack. This is used when parameters are put on the stack before a call to a module and those parameters needs to be removed when the module returns. The new count must be less than or equal to the current number of items.- Parameters:
newCount- the new number of items
-