compiler.semantic.type
Class TypeTable

java.lang.Object
  extended by compiler.semantic.type.TypeTable
All Implemented Interfaces:
TypeTableIF

public class TypeTable
extends java.lang.Object
implements TypeTableIF

Clase que representa la tabla de tipos. Ha de ser implementada por el estudiante


Constructor Summary
TypeTable()
          Constructor for TypeTable.
TypeTable(ScopeIF scope)
          Constructor for TypeTable.
 
Method Summary
 boolean containsType(java.lang.String name)
          Indicates whether the type is contained in the type table.
 boolean containsType(TypeIF symbol)
          Indicates whether the type is contained in the type table.
 boolean equals(java.lang.Object other)
          Compares this object with another one.
 ScopeIF getScope()
          Returns the scope of this Symbol table.
 TypeIF getType(java.lang.String name)
          Looks up a type by name.
 java.util.List getTypes()
          Returns the list of types.
 int hashCode()
          Returns a hash code for the object.
 void setType(java.lang.String name, TypeIF type)
          Sets a type in the type table.
 void setType(TypeIF type)
          Sets a type in the type 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

TypeTable

public TypeTable()
Constructor for TypeTable.


TypeTable

public TypeTable(ScopeIF scope)
Constructor for TypeTable.

Parameters:
scope - The scope where type table is defined.
Method Detail

containsType

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

Specified by:
containsType in interface TypeTableIF
Parameters:
name - The type name.
Returns:
True if the type is contained in the type table.

containsType

public boolean containsType(TypeIF symbol)
Indicates whether the type is contained in the type table.

Specified by:
containsType in interface TypeTableIF
Parameters:
type - The type.
Returns:
True if the symbol is contained in the type 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 TypeTableIF
Returns:
the scope of this Symbol table.

getType

public TypeIF getType(java.lang.String name)
Looks up a type by name.

Specified by:
getType in interface TypeTableIF
Parameters:
name - The name of the type.
Returns:
A type.

getTypes

public java.util.List getTypes()
Returns the list of types.

Specified by:
getTypes in interface TypeTableIF
Returns:
A list of types.

hashCode

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

Overrides:
hashCode in class java.lang.Object

setType

public void setType(java.lang.String name,
                    TypeIF type)
Sets a type in the type table.

Specified by:
setType in interface TypeTableIF
Parameters:
name - the type name.
type - the type.

setType

public void setType(TypeIF type)
Sets a type in the type table.

Specified by:
setType in interface TypeTableIF
Parameters:
type - the type.

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.