adalogo.visitor

Class SymbolTable


public class SymbolTable
extends java.lang.Object

this will store the symbol tables used during interpretation of adalogo code

Constructor Summary

SymbolTable()

Method Summary

void
addSymTabChangedListener(SymbolTable.SymbolTableListener listener)
HLT method to add SymTabChangedListener into EventListeners
void
fireLevelDown()
HLT fire Event methods
void
fireLevelUp()
HLT fire Event methods
void
fireNewVariable(Object name)
HLT fire Event methods
void
fireValueChanged(Object name)
HLT fire Event methods
ListIterator
getIterator()
HLT temporary solution for the VarMonitor.
Object
getType(Object name)
get the type of the variable name.
String
getType(String name)
get the type of the variable name, returns String.
Object
getValue(Object name)
get the value of the variable name.
String
getValue(String name)
get the value of the variable name, returns String.
void
levelDown()
use this when going out of a declarative part.
void
levelUp()
use this when going in to a declarative part
void
put(Object name, Object type, Object value)
add a value to the symbol table.
void
setValue(Object name, Object value)
set a new value for an alreay existing variable.
boolean
variableExists(Object name)
Search in the SymbolTable for name and return true if exists, false otherwise.

Constructor Details

SymbolTable

public SymbolTable()

Method Details

addSymTabChangedListener

public void addSymTabChangedListener(SymbolTable.SymbolTableListener listener)
HLT method to add SymTabChangedListener into EventListeners


fireLevelDown

public void fireLevelDown()
HLT fire Event methods


fireLevelUp

public void fireLevelUp()
HLT fire Event methods


fireNewVariable

public void fireNewVariable(Object name)
HLT fire Event methods


fireValueChanged

public void fireValueChanged(Object name)
HLT fire Event methods


getIterator

public ListIterator getIterator()
HLT temporary solution for the VarMonitor. VarMonitor needs access to the whole symboltable to work.


getType

public Object getType(Object name)
            throws SymbolTable.SymbolTableException
get the type of the variable name. throws exception if variable not found.


getType

public String getType(String name)
            throws SymbolTable.SymbolTableException
get the type of the variable name, returns String. throws exception if variable not found.


getValue

public Object getValue(Object name)
            throws SymbolTable.SymbolTableException
get the value of the variable name. throws exception if variable not found.


getValue

public String getValue(String name)
            throws SymbolTable.SymbolTableException
get the value of the variable name, returns String. throws exception if variable not found.


levelDown

public void levelDown()
            throws SymbolTable.SymbolTableException
use this when going out of a declarative part.


levelUp

public void levelUp()
use this when going in to a declarative part


put

public void put(Object name,
                Object type,
                Object value)
            throws SymbolTable.SymbolTableException
add a value to the symbol table. throws exception if variable already exists.


setValue

public void setValue(Object name,
                     Object value)
            throws SymbolTable.SymbolTableException
set a new value for an alreay existing variable. throws exception if variable not found.


variableExists

public boolean variableExists(Object name)
Search in the SymbolTable for name and return true if exists, false otherwise.