org.norecess.citkit.tir.lvalues
Class FieldLValueTIR

java.lang.Object
  extended by org.norecess.citkit.tir.lvalues.FieldLValueTIR
All Implemented Interfaces:
HobbesTIR, IFieldValueTIR, LValueTIR

public class FieldLValueTIR
extends java.lang.Object
implements IFieldValueTIR

The AST for a field variable of a record.

Author:
Jeremy D. Frens

Constructor Summary
FieldLValueTIR(IPosition position, LValueTIR variable, java.lang.String field)
          Constructs a field variable reference.
FieldLValueTIR(LValueTIR variable, java.lang.String field)
          Basic constructor.
 
Method Summary
<T> T
accept(LValueTIRVisitor<T> visitor)
          Implements the visitor pattern with LValueTIRVisitor.
 boolean equals(java.lang.Object o)
           
 java.lang.String getField()
          Returns the name of the field.
 IPosition getPosition()
          Returns the location of the l-value in the code.
 HobbesType getType()
          Returns the type of the l-value.
 LValueTIR getVariable()
          Returns the variable being dereferenced.
 int hashCode()
           
 void setType(HobbesType type)
          Sets the type of the l-value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FieldLValueTIR

public FieldLValueTIR(IPosition position,
                      LValueTIR variable,
                      java.lang.String field)
Constructs a field variable reference.

Parameters:
position - the position of the field variable in the source code.
variable - the variable being dereferenced.
field - the name of the field.

FieldLValueTIR

public FieldLValueTIR(LValueTIR variable,
                      java.lang.String field)
Basic constructor.

Parameters:
variable - the variable that evaluates to a record.
field - the field of the record to reference.
Method Detail

getField

public java.lang.String getField()
Returns the name of the field.

Specified by:
getField in interface IFieldValueTIR
Returns:
the name of the field.

getVariable

public LValueTIR getVariable()
Returns the variable being dereferenced.

Specified by:
getVariable in interface IFieldValueTIR
Returns:
the variable being dereferenced.

accept

public <T> T accept(LValueTIRVisitor<T> visitor)
Description copied from interface: LValueTIR
Implements the visitor pattern with LValueTIRVisitor.

Specified by:
accept in interface LValueTIR
Type Parameters:
T - the return type from the visit with the visitor.
Parameters:
visitor - the visitor itself.
Returns:
the result of visiting with the visitor.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getType

public HobbesType getType()
Description copied from interface: LValueTIR
Returns the type of the l-value. Useful only in type-checked languages.

Specified by:
getType in interface LValueTIR
Returns:
the type of the l-value.

setType

public void setType(HobbesType type)
Description copied from interface: LValueTIR
Sets the type of the l-value. Needed only in type-checked languages.

Specified by:
setType in interface LValueTIR
Parameters:
type - the type of the l-value.

getPosition

public IPosition getPosition()
Description copied from interface: LValueTIR
Returns the location of the l-value in the code.

Specified by:
getPosition in interface HobbesTIR
Specified by:
getPosition in interface LValueTIR