KickJava   Java API By Example, From Geeks To Geeks.

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


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 AFullIdentNonvoidType extends PNonvoidType
9 {
10     private TFullIdentifier _fullIdentifier_;
11     private final LinkedList _arrayBrackets_ = new TypedLinkedList(new ArrayBrackets_Cast());
12
13     public AFullIdentNonvoidType()
14     {
15     }
16
17     public AFullIdentNonvoidType(
18         TFullIdentifier _fullIdentifier_,
19         List _arrayBrackets_)
20     {
21         setFullIdentifier(_fullIdentifier_);
22
23         {
24             this._arrayBrackets_.clear();
25             this._arrayBrackets_.addAll(_arrayBrackets_);
26         }
27
28     }
29
30     public AFullIdentNonvoidType(
31         TFullIdentifier _fullIdentifier_,
32         XPArrayBrackets _arrayBrackets_)
33     {
34         setFullIdentifier(_fullIdentifier_);
35
36         if(_arrayBrackets_ != null)
37         {
38             while(_arrayBrackets_ instanceof X1PArrayBrackets)
39             {
40                 this._arrayBrackets_.addFirst(((X1PArrayBrackets) _arrayBrackets_).getPArrayBrackets());
41                 _arrayBrackets_ = ((X1PArrayBrackets) _arrayBrackets_).getXPArrayBrackets();
42             }
43             this._arrayBrackets_.addFirst(((X2PArrayBrackets) _arrayBrackets_).getPArrayBrackets());
44         }
45
46     }
47     public Object JavaDoc clone()
48     {
49         return new AFullIdentNonvoidType(
50             (TFullIdentifier) cloneNode(_fullIdentifier_),
51             cloneList(_arrayBrackets_));
52     }
53
54     public void apply(Switch sw)
55     {
56         ((Analysis) sw).caseAFullIdentNonvoidType(this);
57     }
58
59     public TFullIdentifier getFullIdentifier()
60     {
61         return _fullIdentifier_;
62     }
63
64     public void setFullIdentifier(TFullIdentifier node)
65     {
66         if(_fullIdentifier_ != null)
67         {
68             _fullIdentifier_.parent(null);
69         }
70
71         if(node != null)
72         {
73             if(node.parent() != null)
74             {
75                 node.parent().removeChild(node);
76             }
77
78             node.parent(this);
79         }
80
81         _fullIdentifier_ = node;
82     }
83
84     public LinkedList getArrayBrackets()
85     {
86         return _arrayBrackets_;
87     }
88
89     public void setArrayBrackets(List list)
90     {
91         _arrayBrackets_.clear();
92         _arrayBrackets_.addAll(list);
93     }
94
95     public String JavaDoc toString()
96     {
97         return ""
98             + toString(_fullIdentifier_)
99             + toString(_arrayBrackets_);
100     }
101
102     void removeChild(Node child)
103     {
104         if(_fullIdentifier_ == child)
105         {
106             _fullIdentifier_ = null;
107             return;
108         }
109
110         if(_arrayBrackets_.remove(child))
111         {
112             return;
113         }
114
115     }
116
117     void replaceChild(Node oldChild, Node newChild)
118     {
119         if(_fullIdentifier_ == oldChild)
120         {
121             setFullIdentifier((TFullIdentifier) newChild);
122             return;
123         }
124
125         for(ListIterator i = _arrayBrackets_.listIterator(); i.hasNext();)
126         {
127             if(i.next() == oldChild)
128             {
129                 if(newChild != null)
130                 {
131                     i.set(newChild);
132                     oldChild.parent(null);
133                     return;
134                 }
135
136                 i.remove();
137                 oldChild.parent(null);
138                 return;
139             }
140         }
141
142     }
143
144     private class ArrayBrackets_Cast implements Cast
145     {
146         public Object JavaDoc cast(Object JavaDoc o)
147         {
148             PArrayBrackets node = (PArrayBrackets) o;
149
150             if((node.parent() != null) &&
151                 (node.parent() != AFullIdentNonvoidType.this))
152             {
153                 node.parent().removeChild(node);
154             }
155
156             if((node.parent() == null) ||
157                 (node.parent() != AFullIdentNonvoidType.this))
158             {
159                 node.parent(AFullIdentNonvoidType.this);
160             }
161
162             return node;
163         }
164     }
165 }
166
Popular Tags