org.norecess.citkit.tir.expressions
Class WhileETIR

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

public class WhileETIR
extends java.lang.Object
implements IWhileETIR

The TIR for a while statement.

Author:
Jeremy D. Frens

Constructor Summary
WhileETIR(ExpressionTIR test, ExpressionTIR body)
          Basic constructor.
WhileETIR(IPosition position, ExpressionTIR test, ExpressionTIR body)
          Constructs a while loop.
 
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 while expression.
 IPosition getPosition()
          Retrieves the position of the code that generated the AST.
 ExpressionTIR getTest()
          Returns the test of the while expression.
 VoidType 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

WhileETIR

public WhileETIR(IPosition position,
                 ExpressionTIR test,
                 ExpressionTIR body)
Constructs a while loop.

Parameters:
position - the position of the while loop in the source code.
test - the test of the while loop.
body - the body of the while loop.

WhileETIR

public WhileETIR(ExpressionTIR test,
                 ExpressionTIR body)
Basic constructor.

Parameters:
test - the test of the while loop.
body - the body of the while loop.
Method Detail

getBody

public ExpressionTIR getBody()
Returns the body of the while expression.

Specified by:
getBody in interface IWhileETIR
Returns:
the body of the while expression.

getTest

public ExpressionTIR getTest()
Returns the test of the while expression.

Specified by:
getTest in interface IWhileETIR
Returns:
the test of the while expression.

getType

public VoidType 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 AST.

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