|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.webcompmath.data.SymbolTable
public class SymbolTable
A symbol table contains MathObjects, associating them with their names. To support scoping (for example), a symbol table can have a parent symbol table. If a symbol is not found in the table itself, the search procedes to its parent. MathObjects in the parent are hidden by MathObjects of the same name in a SymbolTable. Note that a NullPointerException error will occur if an attempt is made to add a MathObject with a null name to a SymbolTable. A MathObject should not be renamed while it is registered in a SymbolTable. Note that a Parser has an associated SymbolTable. I expect SymbolTables to be used only through Parsers.
Method Summary | |
---|---|
void |
add(MathObject sym)
Adds sym to the SymbolTable, associating it with its name. |
void |
add(java.lang.String name,
MathObject sym)
Adds the given MathObject, sym, to the symbol table, associating it with the given name (which is probably the name of the symbol or that name transformed to lower case, but it doesn't have to be). |
MathObject |
get(java.lang.String name)
Look up the object with the given name, if any. |
void |
remove(java.lang.String name)
Remove the object with the given name from the symbol table, but NOT from the parent symbol table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public MathObject get(java.lang.String name)
name
- name of object to look up
public void add(MathObject sym)
sym
- mathobject to add to tablepublic void add(java.lang.String name, MathObject sym)
name
- name of mathobject to addsym
- mathobject to addpublic void remove(java.lang.String name)
name
- name of mathobject to remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |