KickJava   Java API By Example, From Geeks To Geeks.

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


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 ABinopExpr extends PBinopExpr
9 {
10     private PImmediate _left_;
11     private PBinop _binop_;
12     private PImmediate _right_;
13
14     public ABinopExpr()
15     {
16     }
17
18     public ABinopExpr(
19         PImmediate _left_,
20         PBinop _binop_,
21         PImmediate _right_)
22     {
23         setLeft(_left_);
24
25         setBinop(_binop_);
26
27         setRight(_right_);
28
29     }
30     public Object JavaDoc clone()
31     {
32         return new ABinopExpr(
33             (PImmediate) cloneNode(_left_),
34             (PBinop) cloneNode(_binop_),
35             (PImmediate) cloneNode(_right_));
36     }
37
38     public void apply(Switch sw)
39     {
40         ((Analysis) sw).caseABinopExpr(this);
41     }
42
43     public PImmediate getLeft()
44     {
45         return _left_;
46     }
47
48     public void setLeft(PImmediate node)
49     {
50         if(_left_ != null)
51         {
52             _left_.parent(null);
53         }
54
55         if(node != null)
56         {
57             if(node.parent() != null)
58             {
59                 node.parent().removeChild(node);
60             }
61
62             node.parent(this);
63         }
64
65         _left_ = node;
66     }
67
68     public PBinop getBinop()
69     {
70         return _binop_;
71     }
72
73     public void setBinop(PBinop node)
74     {
75         if(_binop_ != null)
76         {
77             _binop_.parent(null);
78         }
79
80         if(node != null)
81         {
82             if(node.parent() != null)
83             {
84                 node.parent().removeChild(node);
85             }
86
87             node.parent(this);
88         }
89
90         _binop_ = node;
91     }
92
93     public PImmediate getRight()
94     {
95         return _right_;
96     }
97
98     public void setRight(PImmediate node)
99     {
100         if(_right_ != null)
101         {
102             _right_.parent(null);
103         }
104
105         if(node != null)
106         {
107             if(node.parent() != null)
108             {
109                 node.parent().removeChild(node);
110             }
111
112             node.parent(this);
113         }
114
115         _right_ = node;
116     }
117
118     public String JavaDoc toString()
119     {
120         return ""
121             + toString(_left_)
122             + toString(_binop_)
123             + toString(_right_);
124     }
125
126     void removeChild(Node child)
127     {
128         if(_left_ == child)
129         {
130             _left_ = null;
131             return;
132         }
133
134         if(_binop_ == child)
135         {
136             _binop_ = null;
137             return;
138         }
139
140         if(_right_ == child)
141         {
142             _right_ = null;
143             return;
144         }
145
146     }
147
148     void replaceChild(Node oldChild, Node newChild)
149     {
150         if(_left_ == oldChild)
151         {
152             setLeft((PImmediate) newChild);
153             return;
154         }
155
156         if(_binop_ == oldChild)
157         {
158             setBinop((PBinop) newChild);
159             return;
160         }
161
162         if(_right_ == oldChild)
163         {
164             setRight((PImmediate) newChild);
165             return;
166         }
167
168     }
169 }
170
Popular Tags