KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > polyglot > ast > NewArray


1 package polyglot.ast;
2
3 import java.util.List JavaDoc;
4
5 /**
6  * A <code>NewArray</code> represents a new array expression such as <code>new
7  * File[8][] { null }</code>. It consists of an element type (e.g.,
8  * <code>File</code>), a list of dimension expressions (e.g., 8), 0 or more
9  * additional dimensions (e.g., 1 for []), and an array initializer. The
10  * dimensions of the array initializer must equal the number of additional "[]"
11  * dimensions.
12  */

13 public interface NewArray extends Expr
14 {
15     /** The array's base type. */
16     TypeNode baseType();
17
18     /** Set the array's base type. */
19     NewArray baseType(TypeNode baseType);
20
21     /**
22      * The number of array dimensions.
23      * Same as dims().size() + additionalDims().
24      */

25     int numDims();
26
27     /** List of dimension expressions.
28      * @return A list of {@link polyglot.ast.Expr Expr}.
29      */

30     List JavaDoc dims();
31
32     /** Set the list of dimension expressions.
33      * @param dims A list of {@link polyglot.ast.Expr Expr}.
34      */

35     NewArray dims(List JavaDoc dims);
36
37     /** The number of additional dimensions. */
38     int additionalDims();
39
40     /** Set the number of additional dimensions. */
41     NewArray additionalDims(int addDims);
42
43     /** The array initializer, or null. */
44     ArrayInit init();
45
46     /** Set the array initializer. */
47     NewArray init(ArrayInit init);
48 }
49
Free Books   Free Magazines  
Popular Tags