edu.cmu.cs.crystal.tac
Interface NewArrayInstruction

All Superinterfaces:
AssignmentInstruction, TACInstruction

public interface NewArrayInstruction
extends AssignmentInstruction

x = new T[y1]...[yn] or x = new T[]...[] = z.

Author:
Kevin Bierhoff
See Also:
ArrayCreation

Method Summary
 ArrayType getArrayType()
          Returns the type of the array being created.
 java.util.List<Variable> getDimensionOperands()
          Returns the list of operands specifying dimensions of the allocated array.
 int getDimensions()
          Returns the number of dimensions in the new array.
 Variable getInitOperand()
          Returns the array initializer, if any.
 ASTNode getNode()
          Returns the node this instruction is for.
 int getUnallocated()
          Returns the number of dimensions that will be initialized with null cells.
 boolean isInitialized()
          Indicates whether this array has an initializer associated with it.
 
Methods inherited from interface edu.cmu.cs.crystal.tac.AssignmentInstruction
getTarget
 
Methods inherited from interface edu.cmu.cs.crystal.tac.TACInstruction
transfer, transfer
 

Method Detail

getNode

ASTNode getNode()
Returns the node this instruction is for. Should be of type ArrayCreation. Usually, one instruction exists per AST node, but can be more when AST nodes are desugared, such as for post-increment.

Specified by:
getNode in interface TACInstruction
Returns:
the node this instruction is for.
See Also:
TACInstruction.getNode()

getArrayType

ArrayType getArrayType()
Returns the type of the array being created.

Returns:
the type of the array being created.

getDimensionOperands

java.util.List<Variable> getDimensionOperands()
Returns the list of operands specifying dimensions of the allocated array. In new T[y1]...[yn] this would be variables y1, ..., yn. This is only interesting if isInitialized() returns false.

Returns:
the list of operands specifying dimensions of the allocated array.

getDimensions

int getDimensions()
Returns the number of dimensions in the new array.

Returns:
the number of dimensions in the new array.

getUnallocated

int getUnallocated()
Returns the number of dimensions that will be initialized with null cells.

Returns:
the number of dimensions that will be initialized with null cells.

isInitialized

boolean isInitialized()
Indicates whether this array has an initializer associated with it. If this method returns true, the initializer can be retrieved with getInitOperand().

Returns:
true if this array has an initializer, false otherwise.

getInitOperand

Variable getInitOperand()
Returns the array initializer, if any.

Returns:
the array initializer or null if there is none.
See Also:
to test whether this array has an initializer