compiler.semantic.symbol
Class SymbolTable

java.lang.Object
  extended by compiler.semantic.symbol.SymbolTable
All Implemented Interfaces:
SymbolTableIF

public class SymbolTable
extends java.lang.Object
implements SymbolTableIF

Clase que representa una tabla de símbolos. Ha de ser implementada por el estudiante


Constructor Summary
SymbolTable()
          Constructor for TypeTable.
SymbolTable(ScopeIF scope)
          Constructor for TypeTable.
 
Method Summary
 boolean containsSymbol(java.lang.String name)
          Indicates whether the symbol is contained in the symbol table.
 boolean containsSymbol(SymbolIF symbol)
          Indicates whether the symbol is contained in the symbol table.
 boolean equals(java.lang.Object other)
          Compares this object with another one.
 ScopeIF getScope()
          Returns the scope of this Symbol table.
 SymbolIF getSymbol(java.lang.String name)
          Returns a symbol from the symbol table.
 java.util.List getSymbols()
          Returns the list of symbols.
 int hashCode()
          Returns a hash code for the object.
 void setSymbol(java.lang.String name, SymbolIF symbol)
          Sets a symbol to the symbol table.
 java.lang.String toString()
          Return a string representing the object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SymbolTable

public SymbolTable()
Constructor for TypeTable.


SymbolTable

public SymbolTable(ScopeIF scope)
Constructor for TypeTable.

Parameters:
The - scope of the symbol table.
Method Detail

containsSymbol

public boolean containsSymbol(java.lang.String name)
Indicates whether the symbol is contained in the symbol table.

Specified by:
containsSymbol in interface SymbolTableIF
Parameters:
name - The symbol name.
Returns:
True if the symbol is contained in the symbol table.

containsSymbol

public boolean containsSymbol(SymbolIF symbol)
Indicates whether the symbol is contained in the symbol table.

Specified by:
containsSymbol in interface SymbolTableIF
Parameters:
symbol - The symbol.
Returns:
True if the symbol is contained in the symbol table.

equals

public boolean equals(java.lang.Object other)
Compares this object with another one.

Overrides:
equals in class java.lang.Object
Parameters:
other - the other object.
Returns:
true if two objects has the same properties.

getScope

public ScopeIF getScope()
Returns the scope of this Symbol table.

Specified by:
getScope in interface SymbolTableIF
Returns:
the scope of this Symbol table.

getSymbol

public SymbolIF getSymbol(java.lang.String name)
Returns a symbol from the symbol table.

Specified by:
getSymbol in interface SymbolTableIF
Parameters:
name - the symbol key.

getSymbols

public java.util.List getSymbols()
Returns the list of symbols.

Specified by:
getSymbols in interface SymbolTableIF
Returns:
A list of symbols.

hashCode

public int hashCode()
Returns a hash code for the object.

Overrides:
hashCode in class java.lang.Object

setSymbol

public void setSymbol(java.lang.String name,
                      SymbolIF symbol)
Sets a symbol to the symbol table.

Specified by:
setSymbol in interface SymbolTableIF
Parameters:
name - the symbol name.
symbol - the symbol.

toString

public java.lang.String toString()
Return a string representing the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representing the object.