KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > compiler > base > ast > ArrayInitializer


1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the compiler and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  *
22  * Contributor(s):
23  */

24
25 package org.aspectj.compiler.base.ast;
26
27 import org.aspectj.compiler.base.FlowCheckerPass;
28 import org.aspectj.compiler.base.JavaCompiler;
29 import org.aspectj.compiler.base.CodeWriter;
30 import java.io.IOException JavaDoc;
31
32 import java.util.*;
33
34 /**
35  * @grammar {exprs}
36  * @child Exprs exprs
37  */

38 public class ArrayInitializer extends Expr {
39     protected Type discoverType() {
40         return getTypeManager().anyType;
41     }
42
43     public void unparse(CodeWriter writer) throws IOException JavaDoc {
44         writer.openParen('{');
45         writer.write(exprs);
46         writer.closeParen('}');
47     }
48
49     public void cleanup() {
50         exprs = null;
51         super.cleanup();
52     }
53
54     //BEGIN: Generated from @child and @property
55
protected Exprs exprs;
56     public Exprs getExprs() { return exprs; }
57     public void setExprs(Exprs _exprs) {
58         if (_exprs != null) _exprs.setParent(this);
59         exprs = _exprs;
60     }
61
62     public ArrayInitializer(SourceLocation location, Exprs _exprs) {
63         super(location);
64         setExprs(_exprs);
65     }
66     protected ArrayInitializer(SourceLocation source) {
67         super(source);
68     }
69
70     public ASTObject copyWalk(CopyWalker walker) {
71         ArrayInitializer ret = new ArrayInitializer(getSourceLocation());
72         ret.preCopy(walker, this);
73         if (exprs != null) ret.setExprs( (Exprs)walker.process(exprs) );
74         return ret;
75     }
76
77     public ASTObject getChildAt(int childIndex) {
78         switch(childIndex) {
79         case 0: return exprs;
80         default: return super.getChildAt(childIndex);
81         }
82     }
83      public String JavaDoc getChildNameAt(int childIndex) {
84         switch(childIndex) {
85         case 0: return "exprs";
86         default: return super.getChildNameAt(childIndex);
87         }
88     }
89      public void setChildAt(int childIndex, ASTObject child) {
90         switch(childIndex) {
91         case 0: setExprs((Exprs)child); return;
92         default: super.setChildAt(childIndex, child); return;
93         }
94     }
95      public int getChildCount() {
96         return 1;
97     }
98
99     public String JavaDoc getDefaultDisplayName() {
100         return "ArrayInitializer()";
101     }
102
103     //END: Generated from @child and @property
104
}
105
Popular Tags