Interface VariableDereferencer

All Known Implementing Classes:
VariableTable

public abstract interface VariableDereferencer

Interface implemented by any object which wishes to be able to store variable values. This class may work in conjunction with Variable to maintain a single list of all the variable names and values.

The basic concept is that the implementing class keeps a list of variable names and associated values and gives the user access to those values.


Method Summary
 void add(java.lang.String name)
          Add a variable with name name to the dereferencer.
 void assign(java.lang.String name, int value)
          Should allow the user to assign the value of value to the variable of name.
 void demark()
          Remove all variables added to the table since the last mark()
 int dereference(java.lang.String name)
          The class implementing this should be able to return the value associated with name.
 boolean exists(java.lang.String s)
           
 void mark()
          Adds a mark to the table.
 

Method Detail

dereference

public int dereference(java.lang.String name)
The class implementing this should be able to return the value associated with name.
Parameters:
name - variable to return the value of

assign

public void assign(java.lang.String name,
                   int value)
Should allow the user to assign the value of value to the variable of name.
Parameters:
name - variable to assign to
value - value to be assigned to name

add

public void add(java.lang.String name)
Add a variable with name name to the dereferencer. The implementer should be wary of having multiple variables with the same name becasue of potential lost data.
Parameters:
name - variable to add

mark

public void mark()
Adds a mark to the table. If the table is later demarked all variables added since the last mark should be removed.

demark

public void demark()
Remove all variables added to the table since the last mark()

exists

public boolean exists(java.lang.String s)
Parameters:
s - variable name to check for existence
Returns:
whether a variable with name s is in the dereferencer