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

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

public final class RecordDefinition
extends Definition

Record definition AST.

Version:
CVS $Revision: 1.11 $ $Date: 2005/05/26 15:30:41 $
Author:
Robby , Matt Hoosier
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node
ILLEGAL_LOCAL_ID_CHAR
 
Constructor Summary
RecordDefinition(boolean top, boolean throwable, String id, List<String> superIds, List<Field> fields)
          Constructor with super-id.
 
Method Summary
 RecordDefinition clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Disposes fields.
 Field getField(int index)
          Gets a typed-id at the specified index.
 int getFieldCount()
          Gets the number of typed-ids.
 String getId()
          Gets the id.
 ArrayList<String> getOptionalSuperIds()
          Gets the optional super-id.
 boolean getThrowable()
          Gets the throwable.
 boolean getTop()
          Gets the top.
 void setFields(List<Field> newTypedIds)
          Sets the fields.
 void setId(String newId)
          Sets the id.
 void setSuperIds(List<String> newSuperIds)
          Sets the super-id.
 void setThrowable(boolean newThrowable)
          Sets the throwable.
 void setTop(boolean newTop)
          Sets the top.
 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

RecordDefinition

public RecordDefinition(boolean top,
                        boolean throwable,
                        String id,
                        List<String> superIds,
                        List<Field> fields)
Constructor with super-id.

Parameters:
top - The top.
throwable - The throwable.
id - The id. Must be non-null.
superIds - The super-ids. Must be non-null.
fields - The fields declared immediately in this record type (decorated with modifiers such as transient). Must be non-null. Each element must be instance of Pair<TypedId,Boolean>.
Method Detail

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.

getOptionalSuperIds

public ArrayList<String> getOptionalSuperIds()
Gets the optional super-id.

Returns:
The optional super-id.

setSuperIds

public void setSuperIds(List<String> newSuperIds)
Sets the super-id.

Parameters:
newSuperId - The new super-id. Must be non-null.

setThrowable

public void setThrowable(boolean newThrowable)
Sets the throwable.

Parameters:
newThrowable - The new throwable.

getThrowable

public boolean getThrowable()
Gets the throwable.

Returns:
The throwable.

setTop

public void setTop(boolean newTop)
Sets the top.

Parameters:
newTop - The new top.

getTop

public boolean getTop()
Gets the top.

Returns:
The top.

getField

public Field getField(int index)
Gets a typed-id at the specified index.

Parameters:
index - The index of the typed-id. Must be less than getFieldCount().
Returns:
The typed-id at the specified index. Non-null.

getFieldCount

public int getFieldCount()
Gets the number of typed-ids.

Returns:
The number of typed-ids.

setFields

public void setFields(List<Field> newTypedIds)
Sets the fields. Sets this object as each field's parent.

Parameters:
newTypedIds - The new typed-ids. Must be non-null. Each element must be instance of TypedId.

clone

public RecordDefinition 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 fields. 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:
Returns "[ "top" | "throwable" ] record id [ "extends" superId ] { ( [ "transient" ] typedId ";" )* }".

visit

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