• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This file was generated by SableCC (http://www.sablecc.org/). */
2 
3 package com.google.clearsilver.jsilver.syntax.node;
4 
5 import com.google.clearsilver.jsilver.syntax.analysis.*;
6 
7 @SuppressWarnings("nls")
8 public final class AIfCommand extends PCommand
9 {
10     private PPosition _position_;
11     private PExpression _expression_;
12     private PCommand _block_;
13     private PCommand _otherwise_;
14 
AIfCommand()15     public AIfCommand()
16     {
17         // Constructor
18     }
19 
AIfCommand( @uppressWarnings"hiding") PPosition _position_, @SuppressWarnings("hiding") PExpression _expression_, @SuppressWarnings("hiding") PCommand _block_, @SuppressWarnings("hiding") PCommand _otherwise_)20     public AIfCommand(
21         @SuppressWarnings("hiding") PPosition _position_,
22         @SuppressWarnings("hiding") PExpression _expression_,
23         @SuppressWarnings("hiding") PCommand _block_,
24         @SuppressWarnings("hiding") PCommand _otherwise_)
25     {
26         // Constructor
27         setPosition(_position_);
28 
29         setExpression(_expression_);
30 
31         setBlock(_block_);
32 
33         setOtherwise(_otherwise_);
34 
35     }
36 
37     @Override
clone()38     public Object clone()
39     {
40         return new AIfCommand(
41             cloneNode(this._position_),
42             cloneNode(this._expression_),
43             cloneNode(this._block_),
44             cloneNode(this._otherwise_));
45     }
46 
apply(Switch sw)47     public void apply(Switch sw)
48     {
49         ((Analysis) sw).caseAIfCommand(this);
50     }
51 
getPosition()52     public PPosition getPosition()
53     {
54         return this._position_;
55     }
56 
setPosition(PPosition node)57     public void setPosition(PPosition node)
58     {
59         if(this._position_ != null)
60         {
61             this._position_.parent(null);
62         }
63 
64         if(node != null)
65         {
66             if(node.parent() != null)
67             {
68                 node.parent().removeChild(node);
69             }
70 
71             node.parent(this);
72         }
73 
74         this._position_ = node;
75     }
76 
getExpression()77     public PExpression getExpression()
78     {
79         return this._expression_;
80     }
81 
setExpression(PExpression node)82     public void setExpression(PExpression node)
83     {
84         if(this._expression_ != null)
85         {
86             this._expression_.parent(null);
87         }
88 
89         if(node != null)
90         {
91             if(node.parent() != null)
92             {
93                 node.parent().removeChild(node);
94             }
95 
96             node.parent(this);
97         }
98 
99         this._expression_ = node;
100     }
101 
getBlock()102     public PCommand getBlock()
103     {
104         return this._block_;
105     }
106 
setBlock(PCommand node)107     public void setBlock(PCommand node)
108     {
109         if(this._block_ != null)
110         {
111             this._block_.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         this._block_ = node;
125     }
126 
getOtherwise()127     public PCommand getOtherwise()
128     {
129         return this._otherwise_;
130     }
131 
setOtherwise(PCommand node)132     public void setOtherwise(PCommand node)
133     {
134         if(this._otherwise_ != null)
135         {
136             this._otherwise_.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         this._otherwise_ = node;
150     }
151 
152     @Override
toString()153     public String toString()
154     {
155         return ""
156             + toString(this._position_)
157             + toString(this._expression_)
158             + toString(this._block_)
159             + toString(this._otherwise_);
160     }
161 
162     @Override
removeChild(@uppressWarnings"unused") Node child)163     void removeChild(@SuppressWarnings("unused") Node child)
164     {
165         // Remove child
166         if(this._position_ == child)
167         {
168             this._position_ = null;
169             return;
170         }
171 
172         if(this._expression_ == child)
173         {
174             this._expression_ = null;
175             return;
176         }
177 
178         if(this._block_ == child)
179         {
180             this._block_ = null;
181             return;
182         }
183 
184         if(this._otherwise_ == child)
185         {
186             this._otherwise_ = null;
187             return;
188         }
189 
190         throw new RuntimeException("Not a child.");
191     }
192 
193     @Override
replaceChild(@uppressWarnings"unused") Node oldChild, @SuppressWarnings("unused") Node newChild)194     void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
195     {
196         // Replace child
197         if(this._position_ == oldChild)
198         {
199             setPosition((PPosition) newChild);
200             return;
201         }
202 
203         if(this._expression_ == oldChild)
204         {
205             setExpression((PExpression) newChild);
206             return;
207         }
208 
209         if(this._block_ == oldChild)
210         {
211             setBlock((PCommand) newChild);
212             return;
213         }
214 
215         if(this._otherwise_ == oldChild)
216         {
217             setOtherwise((PCommand) newChild);
218             return;
219         }
220 
221         throw new RuntimeException("Not a child.");
222     }
223 }
224