org.norecess.citkit.tir.lvalues
Class SubscriptLValueTIR

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

public class SubscriptLValueTIR
extends java.lang.Object
implements ISubscriptLValueTIR

The AST for a subscripted variable reference.

Author:
Jeremy D. Frens

Constructor Summary
SubscriptLValueTIR(IPosition position, LValueTIR variable, ExpressionTIR index)
          Constructs a subscripted variable reference.
SubscriptLValueTIR(LValueTIR variable, ExpressionTIR index)
          Basic constructor.
 
Method Summary
<T> T
accept(LValueTIRVisitor<T> visitor)
          Implements the visitor pattern with LValueTIRVisitor.
 boolean equals(java.lang.Object o)
           
 ExpressionTIR getIndex()
          Returns the array index of the subscript reference.
 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

SubscriptLValueTIR

public SubscriptLValueTIR(IPosition position,
                          LValueTIR variable,
                          ExpressionTIR index)
Constructs a subscripted variable reference.

Parameters:
position - the position of the subscripted variable reference in the source code.
variable - the subscripted variable.
index - the index of the subscript.

SubscriptLValueTIR

public SubscriptLValueTIR(LValueTIR variable,
                          ExpressionTIR index)
Basic constructor.

Parameters:
variable - the subscripted variable.
index - the index.
Method Detail

getIndex

public ExpressionTIR getIndex()
Returns the array index of the subscript reference.

Specified by:
getIndex in interface ISubscriptLValueTIR
Returns:
the array index of the subscript reference.

getVariable

public LValueTIR getVariable()
Returns the variable being dereferenced.

Specified by:
getVariable in interface ISubscriptLValueTIR
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