|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tenua.symbol.SymbolTable
public class SymbolTable
Constructor Summary | |
---|---|
SymbolTable()
|
Method Summary | |
---|---|
static void |
ensureDefault(java.lang.String name,
double val)
Saves a default value to the user preferences if one was not previously saved |
Symbol |
get(java.lang.String key)
returns the Symbol associated with key |
VariableMemento |
getMemento()
returns a memento of all the variable default values |
java.lang.String |
lookup(java.lang.Object s)
Looks for an Object in the symbol table |
Symbol |
put(double d)
adds an unnamed constant to the SymbolTable |
Symbol |
put(java.lang.String name)
adds a new variable |
Symbol |
put(java.lang.String name,
double d)
adds a named constant to the SymbolTable |
Symbol |
put(java.lang.String key,
Symbol s)
inserts n in the SymbolTable associated with key, replacing the previous association |
void |
saveToPreferences(VariableMemento v)
Saves all the current values of the variables into the user preferences |
Vec |
subset(java.util.List names,
VariableMemento v)
returns a Vec that represents a subset of the values in the symbol table |
Vec |
subset(java.lang.String[] names,
VariableMemento v)
returns a Vec that represents a subset of the values in the symbol table |
java.lang.String[] |
variableList()
returns an array of names of all the variables |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SymbolTable()
Method Detail |
---|
public Symbol get(java.lang.String key)
public Symbol put(java.lang.String key, Symbol s)
key
- the names
- the symbol
public Symbol put(double d) throws tenua.symbol.UnexpectedSymbolException
d
- the value to add
UnexpectedSymbolException
- if a Symbol with the name
Double.toString(d)
already exists but is not a Valuepublic Symbol put(java.lang.String name, double d)
name
- the name of the constantd
- its value
UnexpectedSymbolException
- if the name was previously definedpublic Symbol put(java.lang.String name)
name
- the name of the new Symbol
UnexpectedSymbolException
- if name was previously defined
to something that is not a variable or valuepublic java.lang.String lookup(java.lang.Object s)
s
- the Object to look for
public VariableMemento getMemento()
public Vec subset(java.util.List names, VariableMemento v)
names
- List of String of the names of the symbolsv
- the VariableMemento to use
UnexpectedSymbolException
- if a name is not a Valuepublic Vec subset(java.lang.String[] names, VariableMemento v)
names
- String[] of the names of the symbolsv
- the VariableMemento to use
UnexpectedSymbolException
- if a name is not a Valuepublic java.lang.String[] variableList()
public static void ensureDefault(java.lang.String name, double val)
name
- the name of the variable to saveval
- the valuepublic void saveToPreferences(VariableMemento v)
v
- the VariableMemento to use (if null, uses the default values)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |