org.norecess.citkit.tir.expressions
Class ForETIR

java.lang.Object
  extended by org.norecess.citkit.tir.expressions.ForETIR
All Implemented Interfaces:
IForETIR, ExpressionTIR, HobbesTIR

public class ForETIR
extends java.lang.Object
implements IForETIR

The TIR for a for loop.

Author:
Jeremy D. Frens

Constructor Summary
ForETIR(IPosition position, ISimpleLValueTIR identifier, ExpressionTIR low, ExpressionTIR high, ExpressionTIR body)
          Constructs a for loop.
ForETIR(ISimpleLValueTIR identifier, ExpressionTIR low, ExpressionTIR high, ExpressionTIR body)
          Basic constructor.
 
Method Summary
<T> T
accept(ExpressionTIRVisitor<T> visitor)
          Implements the visitor pattern with ExpressionTIRVisitor.
 boolean equals(java.lang.Object o)
           
 ExpressionTIR getBody()
          Returns the body of the for loop.
 ExpressionTIR getHigh()
          Returns the high value for the index variable.
 ISimpleLValueTIR getIdentifier()
          Returns the variable declaration of the for loop.
 ExpressionTIR getLow()
          Returns the low (initial) value of the index variable.
 IPosition getPosition()
          Retrieves the position of the code that generated the TIR.
 HobbesType getType()
          Retrieves the type of the expression.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ForETIR

public ForETIR(IPosition position,
               ISimpleLValueTIR identifier,
               ExpressionTIR low,
               ExpressionTIR high,
               ExpressionTIR body)
Constructs a for loop.

Parameters:
position - the position of the for loop in the source code.
identifier - the identifier of the loop.
low - the low value of the loop variable.
high - the high value of the loop variable.
body - the body of the loop.

ForETIR

public ForETIR(ISimpleLValueTIR identifier,
               ExpressionTIR low,
               ExpressionTIR high,
               ExpressionTIR body)
Basic constructor.

Parameters:
identifier - the loop index.
low - the starting index value.
high - the ending index value.
body - the body of the loop.
Method Detail

getBody

public ExpressionTIR getBody()
Returns the body of the for loop.

Specified by:
getBody in interface IForETIR
Returns:
the body of the for loop.

getIdentifier

public ISimpleLValueTIR getIdentifier()
Returns the variable declaration of the for loop.

Specified by:
getIdentifier in interface IForETIR
Returns:
the variable declaration of the for loop.

getLow

public ExpressionTIR getLow()
Returns the low (initial) value of the index variable.

Specified by:
getLow in interface IForETIR
Returns:
the low value of the index variable.

getHigh

public ExpressionTIR getHigh()
Returns the high value for the index variable.

Specified by:
getHigh in interface IForETIR
Returns:
the high value for the index variable.

getType

public HobbesType getType()
Description copied from interface: ExpressionTIR
Retrieves the type of the expression.

Specified by:
getType in interface ExpressionTIR
Returns:
the type of the code.

accept

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

Specified by:
accept in interface ExpressionTIR
Parameters:
visitor - the visitor object.
Returns:
the result of visiting the AST 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

getPosition

public IPosition getPosition()
Retrieves the position of the code that generated the TIR.

Specified by:
getPosition in interface HobbesTIR
Returns:
the position of the code in the source code.