Selector Symbol Table
ArchStudio 4

Symbol Table

The SymbolTable included as part of the BooleanEval package provides a very basic mapping from variable to their values. It is implemented with a java hashtable. For complete information, please see the java documentation for SymbolTable. The 2 main functions that will be needed is put and get.


Put simply takes in 2 strings. The first string is the name of the variable. The second string is the string representation of the variable's value. For more information about the string representation, go here. Note that there is a type associated with the value.  The function does not return anything and will throw an exception of the string passed in for value could not be parsed.

Example call:

// this will store the variable a with the string containing hello
symTable.put( "a", "\"hello\"" );


Get simply returns the value associated with the variable. It takes in a single string representing the name of the variable and it returns the value associated with the variable. It does not throw any exceptions; it however will return null if the variable could not be found.

Example call:

// this will retrieve the value associated with the variable a.
// note that the value is an Object and it could be one of 3 classes:
// Date, Double, or String.

// A simple check with instanceof will determine the actual type.
Object value = symTable.get( "a" );

Additional questions about the Symbol Table should be sent to Ping H. Chen.