|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectSymbolTable
public class SymbolTable
A simple table of symbols for a postscript interpreter. This particular implementation is very expensive, and we'll see improved implementations in the latter part of the semester.
| Constructor Summary | |
|---|---|
SymbolTable()
Constructs an empty symbol table. |
|
| Method Summary | |
|---|---|
void |
add(String symbol,
Token value)
Adds a string-value association to the table. |
boolean |
contains(String symbol)
Checks for an entry associated with a particular string. |
Token |
get(String symbol)
Gets a value associated with a string, from the symbol table. |
static void |
main(String[] args)
An example method that makes use of a symbol table. |
Token |
remove(String symbol)
Removes a value associated with the a string. |
String |
toString()
Returns a string representation of the symbol table. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SymbolTable()
| Method Detail |
|---|
public boolean contains(String symbol)
symbol - a string potentially associated with a value.
public void add(String symbol,
Token value)
symbol - a non-null stringvalue - a Token associated with a string.public Token get(String symbol)
symbol - the string whose value is sought
public Token remove(String symbol)
symbol - a string possibly keyed to a value in the symbol table.
public String toString()
toString in class Objectpublic static void main(String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||