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

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.Definition
              extended by edu.ksu.cis.projects.bogor.ast.ConstantDefinition
All Implemented Interfaces:
Disposable, Serializable, Cloneable

public final class ConstantDefinition
extends Definition

Constant definition AST.

Version:
CVS $Revision: 1.8 $ $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
ConstantDefinition(String id, List<? extends Constant> constants)
          Default constructor.
 
Method Summary
 ConstantDefinition clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Removes reference to id, and disposes constants.
 Constant getConstant(int index)
          Gets a constant at a specified index.
 int getConstantCount()
          Gets the number of constants.
 String getId()
          Gets the id.
 void setConstants(List<? extends Constant> newConstants)
          Sets the constants.
 void setId(String newId)
          Sets the id.
 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

ConstantDefinition

public ConstantDefinition(String id,
                          List<? extends Constant> constants)
Default constructor. Set this object as each constant's parent.

Parameters:
id - The id. Must be non-null.
constants - The constants. Must be non-null. Each element must be instance of Constant.
Method Detail

getConstant

public Constant getConstant(int index)
Gets a constant at a specified index.

Parameters:
index - The index of the constant. Must be between 0 and getConstantCount() - 1, inclusive.
Returns:
The constant at the specified index.

getConstantCount

public int getConstantCount()
Gets the number of constants.

Returns:
The number of constants.

setConstants

public void setConstants(List<? extends Constant> newConstants)
Sets the constants. Set this object as each constant's parent.

Parameters:
newConstants - The new constants. Must be non-null. Each element must be instance of Constant.

setId

public void setId(String newId)
Sets the id.

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

getId

public String getId()
Gets the id.

Returns:
The id. Non-null.

clone

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

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

dispose

public void dispose()
Removes reference to id, and disposes constants. 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:
"const id { ( constants; )* }".

visit

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