ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe.ast
Class NewArrayExpr

java.lang.Object
  extended byjavafe.ast.ASTNode
      extended byjavafe.ast.VarInit
          extended byjavafe.ast.Expr
              extended byjavafe.ast.NewArrayExpr
All Implemented Interfaces:
java.lang.Cloneable

public class NewArrayExpr
extends Expr


Field Summary
 ExprVec dims
          If init is null, then holds Expr's between []'s in order.
 ArrayInit init
          The array initializer, if any.
 int loc
           
 int[] locOpenBrackets
          The locations of the open brackets for each Expr (possibly inferred if init !
 Type type
          The type of the elements being given zero-default values, or (if an array initializer is present), the type of the array initializer elements.
 
Fields inherited from class javafe.ast.ASTNode
decorations
 
Constructor Summary
protected NewArrayExpr()
          Construct a raw NewArrayExpr whose class invariant(s) have not yet been established.
 
Method Summary
 void accept(Visitor v)
          Accept a visit from v.
 java.lang.Object accept(VisitorArgResult v, java.lang.Object o)
           
 void check()
           
 java.lang.Object childAt(int index)
          Return the first-but-ith child of a node.
 int childCount()
          Return the number of children a node has.
 int getEndLoc()
           
 int getStartLoc()
           
 int getTag()
          Return the tag of a node.
static NewArrayExpr make(Type type, ExprVec dims, ArrayInit init, int loc, int[] locOpenBrackets)
           
private  void postCheck()
           
 java.lang.String toString()
          Return a string representation of this.
 
Methods inherited from class javafe.ast.ASTNode
clone, clone, getDecorations, setDecorations
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

public Type type
The type of the elements being given zero-default values, or (if an array initializer is present), the type of the array initializer elements.

E.g., new int[4][3][] yields a type of int[] and new int[][][]{a, b} yields a type of int[][].


init

public ArrayInit init
The array initializer, if any. If it is present then dims will contain exactly 1 element, the inferred size of the array initializer.

E.g., new int[][]{7, 5} will generate a dims of {INTLIT(2)}.


dims

public ExprVec dims
If init is null, then holds Expr's between []'s in order. If init is not null, then holds the inferred array size. (cf. init). E.g., new int[x+y][z][] will generate a dims of {, }.


loc

public int loc

locOpenBrackets

public int[] locOpenBrackets
The locations of the open brackets for each Expr (possibly inferred if init != null) in dims.

The open bracket in front of dims[i] is located at locOpenBrackets[i].

Note:
locOpenBrackets may contain junk after the first dims.size() entries.
Constructor Detail

NewArrayExpr

protected NewArrayExpr()
Construct a raw NewArrayExpr whose class invariant(s) have not yet been established. It is the caller's job to initialize the returned node's fields so that any class invariants hold.

Method Detail

getStartLoc

public int getStartLoc()
Specified by:
getStartLoc in class ASTNode

getEndLoc

public int getEndLoc()
Overrides:
getEndLoc in class ASTNode

postCheck

private void postCheck()

make

public static NewArrayExpr make(Type type,
                                ExprVec dims,
                                ArrayInit init,
                                int loc,
                                int[] locOpenBrackets)

childCount

public final int childCount()
Description copied from class: ASTNode
Return the number of children a node has.

Specified by:
childCount in class ASTNode

childAt

public final java.lang.Object childAt(int index)
Description copied from class: ASTNode
Return the first-but-ith child of a node.

Specified by:
childAt in class ASTNode

toString

public final java.lang.String toString()
Description copied from class: ASTNode
Return a string representation of this. Meant for debugging use only, not for presentation.

Specified by:
toString in class ASTNode

getTag

public final int getTag()
Description copied from class: ASTNode
Return the tag of a node.

Specified by:
getTag in class ASTNode

accept

public final void accept(Visitor v)
Description copied from class: ASTNode
Accept a visit from v. This method simply calls the method of v corresponding to the allocated type of this, passing this as the argument. See the design patterns book.

Specified by:
accept in class ASTNode

accept

public final java.lang.Object accept(VisitorArgResult v,
                                     java.lang.Object o)
Specified by:
accept in class ASTNode

check

public void check()
Overrides:
check in class Expr

ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage