edu.ksu.cis.projects.bogor.ast
Class Fun

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.ast.Node
      extended by edu.ksu.cis.projects.bogor.ast.SystemMember
          extended by edu.ksu.cis.projects.bogor.ast.Fun
All Implemented Interfaces:
ITypedIdParent, ITypeParent, Disposable, Serializable, Cloneable

public final class Fun
extends SystemMember
implements ITypedIdParent, ITypeParent

Fun AST.

Version:
CVS $Revision: 1.9 $ $Date: 2005/05/06 17:25:17 $
Author:
Robby
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node
ILLEGAL_LOCAL_ID_CHAR
 
Constructor Summary
Fun(String id, List<TypedId> params, ASTType returnType, Exp exp)
          Default constructor.
 
Method Summary
 Fun clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Disposes returnType.
 Exp getExp()
          Gets the exp.
 String getId()
          Gets the id.
 TypedId getParam(int index)
          Gets the param at a specified index.
 int getParamCount()
          Gets the number of params.
 ASTType getReturnType()
          Gets the return type.
 void setExp(Exp newExp)
          Sets the exp.
 void setId(String newId)
          Sets the function id.
 void setParams(List<TypedId> newParams)
          Sets the params.
 void setReturnType(ASTType newReturnType)
          Sets the return type.
 String toString()
          Returns the string representation of this object.
 void visit(ASTVisitor visitor)
           
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.SystemMember
getParent, setParent
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.Node
getLocationInfo, getProperty, putProperty, setLocationInfo
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Fun

public Fun(String id,
           List<TypedId> params,
           ASTType returnType,
           Exp exp)
Default constructor. Sets this object as each param's, the return type's, and the exp's parent.

Parameters:
id - The id.
params - The params. Must be non-null. Each element must be instance of Param.
returnType - The return type. Must be non-null.
Method Detail

setExp

public void setExp(Exp newExp)
Sets the exp.

Parameters:
newExp - The new exp. Must be non-null.

getExp

public Exp getExp()
Gets the exp.

Returns:
The exp. Non-null.

setId

public void setId(String newId)
Sets the function id.

Parameters:
newId - The new function id. Must be non-null.

getId

public String getId()
Gets the id.

Returns:
The function id. Non-null.

getParam

public TypedId getParam(int index)
Gets the param at a specified index.

Parameters:
index - The index of the param. Must be between 0 and getParamCount() - 1, inclusive.
Returns:
The param at the specified index. Non-null.

getParamCount

public int getParamCount()
Gets the number of params.

Returns:
The number of params.

setParams

public void setParams(List<TypedId> newParams)
Sets the params. Sets this object as each param's parent.

Parameters:
newParams - The new params. Must be non-null. Each element must be instance ofTypedId.

setReturnType

public void setReturnType(ASTType newReturnType)
Sets the return type. Sets this object as the return type's parent.

Parameters:
newReturnType - The new return type. Must be non-null.

getReturnType

public ASTType getReturnType()
Gets the return type.

Returns:
The return type.

clone

public Fun clone()
Clones this object (deep clone); including location info.

Specified by:
clone in class SystemMember
Returns:
The clone of this object. Non-null.

dispose

public void dispose()
Disposes returnType. Once called, avoid using this object.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class SystemMember

toString

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

Specified by:
toString in class Node
Returns:
 "    fun id( ( params , )* ) returns returnType = \n" + "    exp;"
 

visit

public void visit(ASTVisitor visitor)
Specified by:
visit in class Node