polyglot.ast
Interface NewArray

All Superinterfaces:
java.lang.Cloneable, Copy, Expr, JL, Node, NodeOps, Prefix, Receiver, Term, Typed
All Known Subinterfaces:
AmbNewArray, PolyJNewArray
All Known Implementing Classes:
AmbNewArray_c, NewArray_c, PolyJNewArray_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, reachable, reachable
 

Method Detail

baseType

public TypeNode baseType()
The array's base type.


baseType

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


numDims

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


dims

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

Returns:
A list of Expr.

dims

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

Parameters:
dims - A list of Expr.

additionalDims

public int additionalDims()
The number of additional dimensions.


additionalDims

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


init

public ArrayInit init()
The array initializer, or null.


init

public NewArray init(ArrayInit init)
Set the array initializer.