ua.gradsoft.termware
Class SymbolTable

java.lang.Object
  extended by ua.gradsoft.termware.SymbolTable

public class SymbolTable
extends Object

Symbol table for TermWare. We have one symbol table per JVM instance.

Author:
Ruslan Shevchenko

Nested Class Summary
static class SymbolTable.Entry
          entry for name in symbol table.
 
Method Summary
 SymbolTable.Entry adoptName(String name, boolean isAdd)
          find name in symbol table and return entry.
 long getLastModificationTime()
          return time in milliseconds, when Symbol Table was last updated.
 String getName(Integer index)
          get name of existing index.
 Integer getNameIndex(String name)
          get index of existing name in table.
static SymbolTable getSymbolTable()
          return instance of SymbolTable in current JVM
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

adoptName

public SymbolTable.Entry adoptName(String name,
                                   boolean isAdd)
find name in symbol table and return entry. If isAdd parameter is true, then insert name in symbol table.

Parameters:
name - - name to ssearch or insert.
isAdd - - if set to true, than we add name which was not in table.
Returns:
found or inserted Entry or null, if name was not found and isAdd set to false.

getNameIndex

public Integer getNameIndex(String name)
get index of existing name in table.

Returns:
index of name, if one exists in table, otherwise null

getName

public String getName(Integer index)
get name of existing index.

Parameters:
index - - index of name.
Returns:
name, stored in tabele
Throws:
IndexOutOfBoundsException - if index is not in name.

getLastModificationTime

public long getLastModificationTime()
return time in milliseconds, when Symbol Table was last updated.


getSymbolTable

public static SymbolTable getSymbolTable()
return instance of SymbolTable in current JVM