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

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.ast.Node
      extended by edu.ksu.cis.projects.bogor.ast.Exp
          extended by edu.ksu.cis.projects.bogor.ast.LValueExp
              extended by edu.ksu.cis.projects.bogor.ast.FieldAccessExp
All Implemented Interfaces:
IExpParent, Disposable, Serializable, Cloneable

public final class FieldAccessExp
extends LValueExp

Field access exp AST.

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

Field Summary
static int CONSTANT_KEY
          Holds the property key to access constant value.
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Exp
TYPE
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node
ILLEGAL_LOCAL_ID_CHAR
 
Constructor Summary
FieldAccessExp(Exp exp, String id)
          Default constructor.
 
Method Summary
 FieldAccessExp clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Removes reference to id, and disposes exp.
 Exp getExp()
          Gets the exp.
 int getFieldIndex()
          Gets the field index if a record/array field access.
 String getId()
          Gets the id.
 boolean isConstant()
          Determines a constant/enum access.
 boolean isLength()
          Determines an array length access.
 void setConstant()
          Sets to indicate a constant/enum access.
 void setExp(Exp newExp)
          Sets the exp.
 void setFieldIndex(int newFieldIndex)
          Sets the field index if a record/array field access.
 void setId(String newId)
          Sets the id.
 void setLength()
          Sets to indicate a constant/enum access.
 String toString()
          Returns the string representation of this object.
 void visit(ASTVisitor visitor)
           
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.Exp
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
 

Field Detail

CONSTANT_KEY

public static final int CONSTANT_KEY
Holds the property key to access constant value.

See Also:
Constant Field Values
Constructor Detail

FieldAccessExp

public FieldAccessExp(Exp exp,
                      String id)
Default constructor. Sets this object as the exp's parent.

Parameters:
exp - The exp. Must be non-null.
id - The id. Must be non-null.
Method Detail

setConstant

public void setConstant()
Sets to indicate a constant/enum access.


isConstant

public boolean isConstant()
Determines a constant/enum access.

Returns:
True, if a constant/enum access. False, otherwise.

setExp

public void setExp(Exp newExp)
Sets the exp. Sets this object as the exp's parent.

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

getExp

public Exp getExp()
Gets the exp.

Returns:
The exp. Non-null.

setFieldIndex

public void setFieldIndex(int newFieldIndex)
Sets the field index if a record/array field access.

Parameters:
newFieldIndex - The new field index. Must be greater than or equal to zero.

getFieldIndex

public int getFieldIndex()
Gets the field index if a record/array field access.

Returns:
The field index. Greater than or equal 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.

setLength

public void setLength()
Sets to indicate a constant/enum access.


isLength

public boolean isLength()
Determines an array length access.

Returns:
True, if an array length access. False, otherwise.

clone

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

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

dispose

public void dispose()
Removes reference to id, and disposes exp. Once called, avoid using this object.

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

toString

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

Specified by:
toString in class Node
Returns:
"exp.id".

visit

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