edu.ksu.cis.projects.bogor.type
Class FunType

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.type.Type
      extended by edu.ksu.cis.projects.bogor.type.NonPrimitiveType
          extended by edu.ksu.cis.projects.bogor.type.FunType
All Implemented Interfaces:
Disposable, Serializable

public class FunType
extends NonPrimitiveType

Represents a functional type.

Version:
CVS $Revision: 1.3 $ $Date: 2005/01/29 04:54:31 $
Author:
Robby
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.ksu.cis.projects.bogor.type.Type
hashCode, typeId
 
Constructor Summary
FunType(Type[] paramTypes, Type returnType)
          Default constructor.
 
Method Summary
 void dispose()
          Remove references.
 boolean equals(Object o)
          Checks whether this object is equal to another object.
 Type getParamType(int index)
          Gets the parameter type at a certain index.
 int getParamTypeCount()
          Gets the number of parameter types.
 Type getReturnType()
          Gets the return type of this functional type.
 ASTType toASTType()
          Get a newly constructed (unowned) syntax tree node suitable for declaring this type statically.
 String toString()
          Returns the string representation of this object.
 
Methods inherited from class edu.ksu.cis.projects.bogor.type.Type
getTypeId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FunType

public FunType(Type[] paramTypes,
               Type returnType)
Default constructor.

Parameters:
paramTypes - The parameter types of this functional type. Must be non-null. Each element must be non-null.
returnType - The return type of this functional type. Must be non-null.
Method Detail

getParamType

public Type getParamType(int index)
Gets the parameter type at a certain index.

Parameters:
index - The index of the parameter. Must be between 0 and getParamTypeCount() - 1.
Returns:
The parameter type at the given index. Non-null.

getParamTypeCount

public int getParamTypeCount()
Gets the number of parameter types.

Returns:
The number of parameter types.

getReturnType

public Type getReturnType()
Gets the return type of this functional type.

Returns:
The return type of this functional type. Non-null.

dispose

public void dispose()
Description copied from interface: Disposable
Remove references. Once called, avoid using this object.


equals

public boolean equals(Object o)
Checks whether this object is equal to another object.

Overrides:
equals in class Object
Parameters:
o - Another object to check equality to.
Returns:
True, if the id is the same and the argument types are the same. False, otherwise.

toString

public String toString()
Returns the string representation of this object.

Overrides:
toString in class Object
Returns:
"unit -> returnType" or "( * paramTypes )+ -> returnType.

toASTType

public ASTType toASTType()
Get a newly constructed (unowned) syntax tree node suitable for declaring this type statically.

Specified by:
toASTType in class Type
Returns:
the node, or null if the type is undeclarable