org.norecess.citkit.tir.expressions
Class ArrayETIR

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

public class ArrayETIR
extends java.lang.Object
implements IArrayETIR

The TIR for the expression to create (i.e., allocate) a new array.

Author:
Jeremy D. Frens

Constructor Summary
ArrayETIR(IPosition position, java.lang.String type, ExpressionTIR size, ExpressionTIR init)
          Creates an array expression.
ArrayETIR(java.lang.String type, ExpressionTIR size, ExpressionTIR init)
          Basic constructor.
 
Method Summary
<T> T
accept(ExpressionTIRVisitor<T> visitor)
          Implements the visitor pattern with ExpressionTIRVisitor.
 boolean equals(java.lang.Object o)
           
 java.lang.String getElementType()
          Returns the type of the array.
 ExpressionTIR getInit()
          Returns the initialization expression.
 IPosition getPosition()
          Retrieves the position of the code that generated the TIR.
 ExpressionTIR getSize()
          Returns the size of the array.
 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

ArrayETIR

public ArrayETIR(IPosition position,
                 java.lang.String type,
                 ExpressionTIR size,
                 ExpressionTIR init)
Creates an array expression.

Parameters:
position - the position of the array in the source code.
type - the type of the elements.
size - the number of elements in the array.
init - the initialization of the elements.

ArrayETIR

public ArrayETIR(java.lang.String type,
                 ExpressionTIR size,
                 ExpressionTIR init)
Basic constructor.

Parameters:
type - the type of the elements.
size - the number of elements.
init - the initial value of the elements.
Method Detail

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.

getInit

public ExpressionTIR getInit()
Returns the initialization expression.

Specified by:
getInit in interface IArrayETIR
Returns:
the initialization expression.

getSize

public ExpressionTIR getSize()
Returns the size of the array.

Specified by:
getSize in interface IArrayETIR
Returns:
the size of the array.

getElementType

public java.lang.String getElementType()
Returns the type of the array.

Specified by:
getElementType in interface IArrayETIR
Returns:
the type of the array.

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.