jeops.expressions
Class SymbolicTable

java.lang.Object
  |
  +--jeops.expressions.SymbolicTable

public class SymbolicTable
extends java.lang.Object
implements java.lang.Cloneable

This class models a symbolic table to be used by the rules.

Version:
0.06 22 May 1999 First version with comments in English.
Author:
Carlos Figueira Filho (csff@di.ufpe.br)

Constructor Summary
SymbolicTable()
          Class constructor.
 
Method Summary
 java.lang.Object clone()
          Clones this table.
 void dump()
          Prints this table.
 boolean equals(java.lang.Object obj)
          Compares this table with the given object.
 java.lang.String getClassName(java.lang.String ident)
          Returns the class of a variable, given its identifier.
 java.lang.Object getReference(java.lang.String ident)
          Returns the value of a variable, given its identifier.
 java.util.Vector getTriples()
          Returns the triples (class name, ident, value) of this symbolic table.
 int hashCode()
          Returns a hash code for this table.
 void insert(java.lang.String className, java.lang.String ident)
          Inserts a new pair (class name, identifier) in this table.
 void remove(java.lang.String ident)
          Removes a given identifier from this table.
 void setReference(java.lang.String ident, java.lang.Object value)
          Defines the value of a variable, given its identifier and the new value.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolicTable

public SymbolicTable()
Class constructor.
Method Detail

clone

public java.lang.Object clone()
Clones this table.
Returns:
an identical copy of this table.
Since:
0.04

dump

public void dump()
Prints this table. Useful for debugging.

equals

public boolean equals(java.lang.Object obj)
Compares this table with the given object.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to be compared to this table.
Returns:
true if the given object is a table identical to this one; false otherwise.

getClassName

public java.lang.String getClassName(java.lang.String ident)
Returns the class of a variable, given its identifier. If the variable doesn't belong to this table, null will be returned.
Parameters:
ident - the identifier of the variable
Returns:
the class name of the variable

getReference

public java.lang.Object getReference(java.lang.String ident)
Returns the value of a variable, given its identifier.
Parameters:
ident - the identifier of the needed variable.
Returns:
the value of a variable, given its identifier.

getTriples

public java.util.Vector getTriples()
Returns the triples (class name, ident, value) of this symbolic table.
Returns:
the triples for this table.

hashCode

public int hashCode()
Returns a hash code for this table. Used for storing in hashtables.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this table.

insert

public void insert(java.lang.String className,
                   java.lang.String ident)
Inserts a new pair (class name, identifier) in this table. If the identifier already exists, its value is replaced by null.
Parameters:
className - the class name of the variable.
ident - the identifier of the variable.

remove

public void remove(java.lang.String ident)
Removes a given identifier from this table. If the identifier doesn't belong to this table, nothing happens.
Parameters:
ident - the identifier of the entry being removed.

setReference

public void setReference(java.lang.String ident,
                         java.lang.Object value)
Defines the value of a variable, given its identifier and the new value.
Parameters:
ident - the identifier of the variable
value - the value of the variable.