Class DefaultStack
java.lang.Object
jmri.jmrit.logixng.implementation.DefaultStack
- All Implemented Interfaces:
Stack
The default implementation of a NamedTable
-
Nested Class Summary
Nested classes/interfaces inherited from interface jmri.jmrit.logixng.Stack
Stack.ValueAndType -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int(package private) int(package private) static final int(package private) static final int -
Constructor Summary
Constructors -
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 valueAndType) 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
-
Field Details
-
Constructor Details
-
DefaultStack
public DefaultStack()
-
-
Method Details
-
push
Pushes a value on the top of the stack so the stack grow. -
pop
Pops the topmost value off the top of the stack so the stack shrinks. -
getValueAtIndex
Get the value at an index- Specified by:
getValueAtIndexin interfaceStack- Parameters:
index- the index from bottom of the table- Returns:
- value the new value
-
setValueAtIndex
Set the value at an index- Specified by:
setValueAtIndexin interfaceStack- Parameters:
index- the index from bottom of the tablevalue- the new value
-
getValueAndTypeAtIndex
Get the value and type at an index- Specified by:
getValueAndTypeAtIndexin interfaceStack- Parameters:
index- the index from bottom of the table- Returns:
- value and type the new value
-
setValueAndTypeAtIndex
Set the value at an index- Specified by:
setValueAndTypeAtIndexin interfaceStack- Parameters:
index- the index from bottom of the tablevalueAndType- the new value and type
-
getCount
Get the number of items on the stack -
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.
-