KickJava   Java API By Example, From Geeks To Geeks.

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


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 AFile extends PFile
9 {
10     private final LinkedList _modifier_ = new TypedLinkedList(new Modifier_Cast());
11     private PFileType _fileType_;
12     private PClassName _className_;
13     private PExtendsClause _extendsClause_;
14     private PImplementsClause _implementsClause_;
15     private PFileBody _fileBody_;
16
17     public AFile()
18     {
19     }
20
21     public AFile(
22         List _modifier_,
23         PFileType _fileType_,
24         PClassName _className_,
25         PExtendsClause _extendsClause_,
26         PImplementsClause _implementsClause_,
27         PFileBody _fileBody_)
28     {
29         {
30             this._modifier_.clear();
31             this._modifier_.addAll(_modifier_);
32         }
33
34         setFileType(_fileType_);
35
36         setClassName(_className_);
37
38         setExtendsClause(_extendsClause_);
39
40         setImplementsClause(_implementsClause_);
41
42         setFileBody(_fileBody_);
43
44     }
45
46     public AFile(
47         XPModifier _modifier_,
48         PFileType _fileType_,
49         PClassName _className_,
50         PExtendsClause _extendsClause_,
51         PImplementsClause _implementsClause_,
52         PFileBody _fileBody_)
53     {
54         if(_modifier_ != null)
55         {
56             while(_modifier_ instanceof X1PModifier)
57             {
58                 this._modifier_.addFirst(((X1PModifier) _modifier_).getPModifier());
59                 _modifier_ = ((X1PModifier) _modifier_).getXPModifier();
60             }
61             this._modifier_.addFirst(((X2PModifier) _modifier_).getPModifier());
62         }
63
64         setFileType(_fileType_);
65
66         setClassName(_className_);
67
68         setExtendsClause(_extendsClause_);
69
70         setImplementsClause(_implementsClause_);
71
72         setFileBody(_fileBody_);
73
74     }
75     public Object JavaDoc clone()
76     {
77         return new AFile(
78             cloneList(_modifier_),
79             (PFileType) cloneNode(_fileType_),
80             (PClassName) cloneNode(_className_),
81             (PExtendsClause) cloneNode(_extendsClause_),
82             (PImplementsClause) cloneNode(_implementsClause_),
83             (PFileBody) cloneNode(_fileBody_));
84     }
85
86     public void apply(Switch sw)
87     {
88         ((Analysis) sw).caseAFile(this);
89     }
90
91     public LinkedList getModifier()
92     {
93         return _modifier_;
94     }
95
96     public void setModifier(List list)
97     {
98         _modifier_.clear();
99         _modifier_.addAll(list);
100     }
101
102     public PFileType getFileType()
103     {
104         return _fileType_;
105     }
106
107     public void setFileType(PFileType node)
108     {
109         if(_fileType_ != null)
110         {
111             _fileType_.parent(null);
112         }
113
114         if(node != null)
115         {
116             if(node.parent() != null)
117             {
118                 node.parent().removeChild(node);
119             }
120
121             node.parent(this);
122         }
123
124         _fileType_ = node;
125     }
126
127     public PClassName getClassName()
128     {
129         return _className_;
130     }
131
132     public void setClassName(PClassName node)
133     {
134         if(_className_ != null)
135         {
136             _className_.parent(null);
137         }
138
139         if(node != null)
140         {
141             if(node.parent() != null)
142             {
143                 node.parent().removeChild(node);
144             }
145
146             node.parent(this);
147         }
148
149         _className_ = node;
150     }
151
152     public PExtendsClause getExtendsClause()
153     {
154         return _extendsClause_;
155     }
156
157     public void setExtendsClause(PExtendsClause node)
158     {
159         if(_extendsClause_ != null)
160         {
161             _extendsClause_.parent(null);
162         }
163
164         if(node != null)
165         {
166             if(node.parent() != null)
167             {
168                 node.parent().removeChild(node);
169             }
170
171             node.parent(this);
172         }
173
174         _extendsClause_ = node;
175     }
176
177     public PImplementsClause getImplementsClause()
178     {
179         return _implementsClause_;
180     }
181
182     public void setImplementsClause(PImplementsClause node)
183     {
184         if(_implementsClause_ != null)
185         {
186             _implementsClause_.parent(null);
187         }
188
189         if(node != null)
190         {
191             if(node.parent() != null)
192             {
193                 node.parent().removeChild(node);
194             }
195
196             node.parent(this);
197         }
198
199         _implementsClause_ = node;
200     }
201
202     public PFileBody getFileBody()
203     {
204         return _fileBody_;
205     }
206
207     public void setFileBody(PFileBody node)
208     {
209         if(_fileBody_ != null)
210         {
211             _fileBody_.parent(null);
212         }
213
214         if(node != null)
215         {
216             if(node.parent() != null)
217             {
218                 node.parent().removeChild(node);
219             }
220
221             node.parent(this);
222         }
223
224         _fileBody_ = node;
225     }
226
227     public String JavaDoc toString()
228     {
229         return ""
230             + toString(_modifier_)
231             + toString(_fileType_)
232             + toString(_className_)
233             + toString(_extendsClause_)
234             + toString(_implementsClause_)
235             + toString(_fileBody_);
236     }
237
238     void removeChild(Node child)
239     {
240         if(_modifier_.remove(child))
241         {
242             return;
243         }
244
245         if(_fileType_ == child)
246         {
247             _fileType_ = null;
248             return;
249         }
250
251         if(_className_ == child)
252         {
253             _className_ = null;
254             return;
255         }
256
257         if(_extendsClause_ == child)
258         {
259             _extendsClause_ = null;
260             return;
261         }
262
263         if(_implementsClause_ == child)
264         {
265             _implementsClause_ = null;
266             return;
267         }
268
269         if(_fileBody_ == child)
270         {
271             _fileBody_ = null;
272             return;
273         }
274
275     }
276
277     void replaceChild(Node oldChild, Node newChild)
278     {
279         for(ListIterator i = _modifier_.listIterator(); i.hasNext();)
280         {
281             if(i.next() == oldChild)
282             {
283                 if(newChild != null)
284                 {
285                     i.set(newChild);
286                     oldChild.parent(null);
287                     return;
288                 }
289
290                 i.remove();
291                 oldChild.parent(null);
292                 return;
293             }
294         }
295
296         if(_fileType_ == oldChild)
297         {
298             setFileType((PFileType) newChild);
299             return;
300         }
301
302         if(_className_ == oldChild)
303         {
304             setClassName((PClassName) newChild);
305             return;
306         }
307
308         if(_extendsClause_ == oldChild)
309         {
310             setExtendsClause((PExtendsClause) newChild);
311             return;
312         }
313
314         if(_implementsClause_ == oldChild)
315         {
316             setImplementsClause((PImplementsClause) newChild);
317             return;
318         }
319
320         if(_fileBody_ == oldChild)
321         {
322             setFileBody((PFileBody) newChild);
323             return;
324         }
325
326     }
327
328     private class Modifier_Cast implements Cast
329     {
330         public Object JavaDoc cast(Object JavaDoc o)
331         {
332             PModifier node = (PModifier) o;
333
334             if((node.parent() != null) &&
335                 (node.parent() != AFile.this))
336             {
337                 node.parent().removeChild(node);
338             }
339
340             if((node.parent() == null) ||
341                 (node.parent() != AFile.this))
342             {
343                 node.parent(AFile.this);
344             }
345
346             return node;
347         }
348     }
349 }
350
Popular Tags