KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > jimple > parser > node > AMultiNewExpr


1 /* This file was generated by SableCC (http://www.sablecc.org/). */
2
3 package soot.jimple.parser.node;
4
5 import java.util.*;
6 import soot.jimple.parser.analysis.*;
7
8 public final class AMultiNewExpr extends PNewExpr
9 {
10     private TNewmultiarray _newmultiarray_;
11     private TLParen _lParen_;
12     private PBaseType _baseType_;
13     private TRParen _rParen_;
14     private final LinkedList _arrayDescriptor_ = new TypedLinkedList(new ArrayDescriptor_Cast());
15
16     public AMultiNewExpr()
17     {
18     }
19
20     public AMultiNewExpr(
21         TNewmultiarray _newmultiarray_,
22         TLParen _lParen_,
23         PBaseType _baseType_,
24         TRParen _rParen_,
25         List _arrayDescriptor_)
26     {
27         setNewmultiarray(_newmultiarray_);
28
29         setLParen(_lParen_);
30
31         setBaseType(_baseType_);
32
33         setRParen(_rParen_);
34
35         {
36             this._arrayDescriptor_.clear();
37             this._arrayDescriptor_.addAll(_arrayDescriptor_);
38         }
39
40     }
41
42     public AMultiNewExpr(
43         TNewmultiarray _newmultiarray_,
44         TLParen _lParen_,
45         PBaseType _baseType_,
46         TRParen _rParen_,
47         XPArrayDescriptor _arrayDescriptor_)
48     {
49         setNewmultiarray(_newmultiarray_);
50
51         setLParen(_lParen_);
52
53         setBaseType(_baseType_);
54
55         setRParen(_rParen_);
56
57         if(_arrayDescriptor_ != null)
58         {
59             while(_arrayDescriptor_ instanceof X1PArrayDescriptor)
60             {
61                 this._arrayDescriptor_.addFirst(((X1PArrayDescriptor) _arrayDescriptor_).getPArrayDescriptor());
62                 _arrayDescriptor_ = ((X1PArrayDescriptor) _arrayDescriptor_).getXPArrayDescriptor();
63             }
64             this._arrayDescriptor_.addFirst(((X2PArrayDescriptor) _arrayDescriptor_).getPArrayDescriptor());
65         }
66
67     }
68     public Object JavaDoc clone()
69     {
70         return new AMultiNewExpr(
71             (TNewmultiarray) cloneNode(_newmultiarray_),
72             (TLParen) cloneNode(_lParen_),
73             (PBaseType) cloneNode(_baseType_),
74             (TRParen) cloneNode(_rParen_),
75             cloneList(_arrayDescriptor_));
76     }
77
78     public void apply(Switch sw)
79     {
80         ((Analysis) sw).caseAMultiNewExpr(this);
81     }
82
83     public TNewmultiarray getNewmultiarray()
84     {
85         return _newmultiarray_;
86     }
87
88     public void setNewmultiarray(TNewmultiarray node)
89     {
90         if(_newmultiarray_ != null)
91         {
92             _newmultiarray_.parent(null);
93         }
94
95         if(node != null)
96         {
97             if(node.parent() != null)
98             {
99                 node.parent().removeChild(node);
100             }
101
102             node.parent(this);
103         }
104
105         _newmultiarray_ = node;
106     }
107
108     public TLParen getLParen()
109     {
110         return _lParen_;
111     }
112
113     public void setLParen(TLParen node)
114     {
115         if(_lParen_ != null)
116         {
117             _lParen_.parent(null);
118         }
119
120         if(node != null)
121         {
122             if(node.parent() != null)
123             {
124                 node.parent().removeChild(node);
125             }
126
127             node.parent(this);
128         }
129
130         _lParen_ = node;
131     }
132
133     public PBaseType getBaseType()
134     {
135         return _baseType_;
136     }
137
138     public void setBaseType(PBaseType node)
139     {
140         if(_baseType_ != null)
141         {
142             _baseType_.parent(null);
143         }
144
145         if(node != null)
146         {
147             if(node.parent() != null)
148             {
149                 node.parent().removeChild(node);
150             }
151
152             node.parent(this);
153         }
154
155         _baseType_ = node;
156     }
157
158     public TRParen getRParen()
159     {
160         return _rParen_;
161     }
162
163     public void setRParen(TRParen node)
164     {
165         if(_rParen_ != null)
166         {
167             _rParen_.parent(null);
168         }
169
170         if(node != null)
171         {
172             if(node.parent() != null)
173             {
174                 node.parent().removeChild(node);
175             }
176
177             node.parent(this);
178         }
179
180         _rParen_ = node;
181     }
182
183     public LinkedList getArrayDescriptor()
184     {
185         return _arrayDescriptor_;
186     }
187
188     public void setArrayDescriptor(List list)
189     {
190         _arrayDescriptor_.clear();
191         _arrayDescriptor_.addAll(list);
192     }
193
194     public String JavaDoc toString()
195     {
196         return ""
197             + toString(_newmultiarray_)
198             + toString(_lParen_)
199             + toString(_baseType_)
200             + toString(_rParen_)
201             + toString(_arrayDescriptor_);
202     }
203
204     void removeChild(Node child)
205     {
206         if(_newmultiarray_ == child)
207         {
208             _newmultiarray_ = null;
209             return;
210         }
211
212         if(_lParen_ == child)
213         {
214             _lParen_ = null;
215             return;
216         }
217
218         if(_baseType_ == child)
219         {
220             _baseType_ = null;
221             return;
222         }
223
224         if(_rParen_ == child)
225         {
226             _rParen_ = null;
227             return;
228         }
229
230         if(_arrayDescriptor_.remove(child))
231         {
232             return;
233         }
234
235     }
236
237     void replaceChild(Node oldChild, Node newChild)
238     {
239         if(_newmultiarray_ == oldChild)
240         {
241             setNewmultiarray((TNewmultiarray) newChild);
242             return;
243         }
244
245         if(_lParen_ == oldChild)
246         {
247             setLParen((TLParen) newChild);
248             return;
249         }
250
251         if(_baseType_ == oldChild)
252         {
253             setBaseType((PBaseType) newChild);
254             return;
255         }
256
257         if(_rParen_ == oldChild)
258         {
259             setRParen((TRParen) newChild);
260             return;
261         }
262
263         for(ListIterator i = _arrayDescriptor_.listIterator(); i.hasNext();)
264         {
265             if(i.next() == oldChild)
266             {
267                 if(newChild != null)
268                 {
269                     i.set(newChild);
270                     oldChild.parent(null);
271                     return;
272                 }
273
274                 i.remove();
275                 oldChild.parent(null);
276                 return;
277             }
278         }
279
280     }
281
282     private class ArrayDescriptor_Cast implements Cast
283     {
284         public Object JavaDoc cast(Object JavaDoc o)
285         {
286             PArrayDescriptor node = (PArrayDescriptor) o;
287
288             if((node.parent() != null) &&
289                 (node.parent() != AMultiNewExpr.this))
290             {
291                 node.parent().removeChild(node);
292             }
293
294             if((node.parent() == null) ||
295                 (node.parent() != AMultiNewExpr.this))
296             {
297                 node.parent(AMultiNewExpr.this);
298             }
299
300             return node;
301         }
302     }
303 }
304
Popular Tags