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

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.EnumDefinition
All Implemented Interfaces:
Disposable, Serializable, Cloneable

public final class EnumDefinition
extends Definition

Enum definition AST.

Version:
CVS $Revision: 1.7 $ $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
EnumDefinition(String id, List<String> enumConstants)
          Default constructor.
 
Method Summary
 EnumDefinition clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Disposes enumConstants.
 String getEnumConstant(int index)
          Gets an enum constant at a specified index.
 int getEnumConstantCount()
          Gets the number of enum constants.
 String getId()
          Gets the id.
 void setEnumConstants(List<String> newEnumConstants)
          Sets the enum 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

EnumDefinition

public EnumDefinition(String id,
                      List<String> enumConstants)
Default constructor.

Parameters:
id - The id. Must be non-null.
enumConstants - The enum constants. Must be non-null. Each element must be instance of String. The number of elements must be greater than zero.
Method Detail

getEnumConstant

public String getEnumConstant(int index)
Gets an enum constant at a specified index.

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

getEnumConstantCount

public int getEnumConstantCount()
Gets the number of enum constants.

Returns:
The number of enum constants. Greater than zero.

setEnumConstants

public void setEnumConstants(List<String> newEnumConstants)
Sets the enum constants.

Parameters:
newEnumConstants - The new enum constants. Must be non-null. Each element must be instance of String. The number of elements must be greater than zero.

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 EnumDefinition 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()
Disposes enumConstants. 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:
"enum id { ( senumconstants , )* }".

visit

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