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 Modifier and Type Interface Description static class
Stack.ValueAndType
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getCount()
Get the number of items on the stackStack.ValueAndType
getValueAndTypeAtIndex(int index)
Get the value and type at an indexjava.lang.Object
getValueAtIndex(int index)
Get the value at an indexjava.lang.Object
pop()
Pops the topmost value off the top of the stack so the stack shrinks.void
push(Stack.ValueAndType value)
Pushes a value on the top of the stack so the stack grow.void
setCount(int newCount)
Reset the number of items on the stack.void
setValueAndTypeAtIndex(int index, Stack.ValueAndType valueAndType)
Set the value at an indexvoid
setValueAtIndex(int index, java.lang.Object value)
Set the value at an index
-
-
-
Method Detail
-
push
void push(Stack.ValueAndType value)
Pushes a value on the top of the stack so the stack grow.- Parameters:
value
- the value to push to the stack
-
pop
java.lang.Object 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
java.lang.Object getValueAtIndex(int index)
Get the value at an index- Parameters:
index
- the index from bottom of the table- Returns:
- value the new value
-
setValueAtIndex
void setValueAtIndex(int index, java.lang.Object value)
Set the value at an index- Parameters:
index
- the index from bottom of the tablevalue
- the new value
-
getValueAndTypeAtIndex
Stack.ValueAndType getValueAndTypeAtIndex(int index)
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
void setValueAndTypeAtIndex(int index, Stack.ValueAndType valueAndType)
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
void setCount(int newCount)
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
-
-