polyglot.ast
Interface NewArray

All Superinterfaces:
java.lang.Cloneable, Copy, Expr, JL, Node, NodeOps, Prefix, Receiver, Term, Typed
All Known Implementing Classes:
NewArray_c

public interface NewArray
extends Expr

A NewArray represents a new array expression such as new File[8][] { null }. It consists of an element type (e.g., File), a list of dimension expressions (e.g., 8), 0 or more additional dimensions (e.g., 1 for []), and an array initializer. The dimensions of the array initializer must equal the number of additional "[]" dimensions.


Method Summary
 int additionalDims()
          The number of additional dimensions.
 NewArray additionalDims(int addDims)
          Set the number of additional dimensions.
 TypeNode baseType()
          The array's base type.
 NewArray baseType(TypeNode baseType)
          Set the array's base type.
 java.util.List dims()
          List of dimension expressions.
 NewArray dims(java.util.List dims)
          Set the list of dimension expressions.
 ArrayInit init()
          The array initializer, or null.
 NewArray init(ArrayInit init)
          Set the array initializer.
 int numDims()
          The number of array dimensions.
 
Methods inherited from interface polyglot.ast.Expr
constantValue, isConstant, precedence, printSubExpr, printSubExpr, type
 
Methods inherited from interface polyglot.ast.Node
childExpectedType, del, del, dump, ext, ext, ext, ext, position, position, visit, visitChild, visitEdge, visitList
 
Methods inherited from interface polyglot.ast.JL
init, node
 
Methods inherited from interface polyglot.ast.NodeOps
addDecls, addMembers, addMembersEnter, buildTypes, buildTypesEnter, disambiguate, disambiguateEnter, enterScope, enterScope, exceptionCheck, exceptionCheckEnter, prettyPrint, throwTypes, translate, typeCheck, typeCheckEnter, visitChildren
 
Methods inherited from interface polyglot.util.Copy
copy
 
Methods inherited from interface polyglot.ast.Typed
type
 
Methods inherited from interface polyglot.ast.Term
acceptCFG, entry, exceptions, exceptions, reachable, reachable
 

Method Detail

baseType

TypeNode baseType()
The array's base type.


baseType

NewArray baseType(TypeNode baseType)
Set the array's base type.


numDims

int numDims()
The number of array dimensions. Same as dims().size() + additionalDims().


dims

java.util.List dims()
List of dimension expressions.

Returns:
A list of Expr.

dims

NewArray dims(java.util.List dims)
Set the list of dimension expressions.

Parameters:
dims - A list of Expr.

additionalDims

int additionalDims()
The number of additional dimensions.


additionalDims

NewArray additionalDims(int addDims)
Set the number of additional dimensions.


init

ArrayInit init()
The array initializer, or null.


init

NewArray init(ArrayInit init)
Set the array initializer.