Class DefaultSymbolTable
java.lang.Object
jmri.jmrit.logixng.implementation.DefaultSymbolTable
- All Implemented Interfaces:
SymbolTable
The default implementation of a NamedTable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from interface jmri.jmrit.logixng.SymbolTable
SymbolTable.InitialValueType, SymbolTable.Symbol, SymbolTable.SymbolNotFound, SymbolTable.Type, SymbolTable.VariableData -
Field Summary
Fields inherited from interface jmri.jmrit.logixng.SymbolTable
log -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance of DefaultSymbolTable with no previous symbol table.DefaultSymbolTable(ConditionalNG currentConditionalNG) Create a new instance of DefaultSymbolTable with previous symbol table and the stack from a ConditionalNG.DefaultSymbolTable(SymbolTable prevSymbolTable) Create a new instance of DefaultSymbolTable from a previous symbol table and a stack. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateSymbols(Collection<? extends SymbolTable.VariableData> symbolDefinitions) Add new symbols to the symbol tablevoidcreateSymbols(SymbolTable symbolTable, Collection<? extends SymbolTable.VariableData> symbolDefinitions) Add new symbols to the symbol table.Get the previous symbol tablegetStack()Get the stack.The list of symbols in the tableThe list of symbols and their values in the tableGet the value of a symbolgetValueAndType(String name) Get the value and type of a symbol.booleanIs the symbol in the symbol table?voidprintSymbolTable(PrintWriter stream) Print the symbol table on a streamvoidremoveSymbols(Collection<? extends SymbolTable.VariableData> symbolDefinitions) Removes symbols from the symbol tablevoidSet the value of a symbol
-
Constructor Details
-
DefaultSymbolTable
public DefaultSymbolTable()Create a new instance of DefaultSymbolTable with no previous symbol table. -
DefaultSymbolTable
Create a new instance of DefaultSymbolTable with previous symbol table and the stack from a ConditionalNG.- Parameters:
currentConditionalNG- the ConditionalNG
-
DefaultSymbolTable
Create a new instance of DefaultSymbolTable from a previous symbol table and a stack.- Parameters:
prevSymbolTable- the previous symbol table
-
-
Method Details
-
getPrevSymbolTable
Get the previous symbol table- Returns:
- the symbol table
-
getSymbols
The list of symbols in the table- Specified by:
getSymbolsin interfaceSymbolTable- Returns:
- the symbols
-
getSymbolValues
The list of symbols and their values in the table- Specified by:
getSymbolValuesin interfaceSymbolTable- Returns:
- the name of the symbols and their values
-
getValue
Get the value of a symbol- Specified by:
getValuein interfaceSymbolTable- Parameters:
name- the name- Returns:
- the value
-
getValueAndType
Get the value and type of a symbol. This method does not lookup global variables.- Specified by:
getValueAndTypein interfaceSymbolTable- Parameters:
name- the name- Returns:
- the value and type
-
hasValue
Is the symbol in the symbol table?- Specified by:
hasValuein interfaceSymbolTable- Parameters:
name- the name- Returns:
- true if the symbol exists, false otherwise
-
setValue
Set the value of a symbol- Specified by:
setValuein interfaceSymbolTable- Parameters:
name- the namevalue- the value
-
printSymbolTable
Print the symbol table on a stream- Specified by:
printSymbolTablein interfaceSymbolTable- Parameters:
stream- the stream
-
createSymbols
public void createSymbols(Collection<? extends SymbolTable.VariableData> symbolDefinitions) throws JmriException Add new symbols to the symbol table- Specified by:
createSymbolsin interfaceSymbolTable- Parameters:
symbolDefinitions- the definitions of the new symbols- Throws:
JmriException- if an exception is thrown
-
createSymbols
public void createSymbols(SymbolTable symbolTable, Collection<? extends SymbolTable.VariableData> symbolDefinitions) throws JmriException Add new symbols to the symbol table. This method is used for parameters, when new symbols might be created that uses symbols from a previous symbol table.- Specified by:
createSymbolsin interfaceSymbolTable- Parameters:
symbolTable- the symbol table to get existing symbols fromsymbolDefinitions- the definitions of the new symbols- Throws:
JmriException- if an exception is thrown
-
removeSymbols
public void removeSymbols(Collection<? extends SymbolTable.VariableData> symbolDefinitions) throws JmriException Removes symbols from the symbol table- Specified by:
removeSymbolsin interfaceSymbolTable- Parameters:
symbolDefinitions- the definitions of the symbols to be removed- Throws:
JmriException- if an exception is thrown
-
getStack
Get the stack. This method is only used internally by DefaultSymbolTable.- Specified by:
getStackin interfaceSymbolTable- Returns:
- the stack
-