1/* This file was generated by SableCC (http://www.sablecc.org/). */
2
3package com.google.clearsilver.jsilver.syntax.node;
4
5import com.google.clearsilver.jsilver.syntax.analysis.*;
6
7@SuppressWarnings("nls")
8public final class ALoopIncCommand extends PCommand
9{
10    private PPosition _position_;
11    private PVariable _variable_;
12    private PExpression _start_;
13    private PExpression _end_;
14    private PExpression _increment_;
15    private PCommand _command_;
16
17    public ALoopIncCommand()
18    {
19        // Constructor
20    }
21
22    public ALoopIncCommand(
23        @SuppressWarnings("hiding") PPosition _position_,
24        @SuppressWarnings("hiding") PVariable _variable_,
25        @SuppressWarnings("hiding") PExpression _start_,
26        @SuppressWarnings("hiding") PExpression _end_,
27        @SuppressWarnings("hiding") PExpression _increment_,
28        @SuppressWarnings("hiding") PCommand _command_)
29    {
30        // Constructor
31        setPosition(_position_);
32
33        setVariable(_variable_);
34
35        setStart(_start_);
36
37        setEnd(_end_);
38
39        setIncrement(_increment_);
40
41        setCommand(_command_);
42
43    }
44
45    @Override
46    public Object clone()
47    {
48        return new ALoopIncCommand(
49            cloneNode(this._position_),
50            cloneNode(this._variable_),
51            cloneNode(this._start_),
52            cloneNode(this._end_),
53            cloneNode(this._increment_),
54            cloneNode(this._command_));
55    }
56
57    public void apply(Switch sw)
58    {
59        ((Analysis) sw).caseALoopIncCommand(this);
60    }
61
62    public PPosition getPosition()
63    {
64        return this._position_;
65    }
66
67    public void setPosition(PPosition node)
68    {
69        if(this._position_ != null)
70        {
71            this._position_.parent(null);
72        }
73
74        if(node != null)
75        {
76            if(node.parent() != null)
77            {
78                node.parent().removeChild(node);
79            }
80
81            node.parent(this);
82        }
83
84        this._position_ = node;
85    }
86
87    public PVariable getVariable()
88    {
89        return this._variable_;
90    }
91
92    public void setVariable(PVariable node)
93    {
94        if(this._variable_ != null)
95        {
96            this._variable_.parent(null);
97        }
98
99        if(node != null)
100        {
101            if(node.parent() != null)
102            {
103                node.parent().removeChild(node);
104            }
105
106            node.parent(this);
107        }
108
109        this._variable_ = node;
110    }
111
112    public PExpression getStart()
113    {
114        return this._start_;
115    }
116
117    public void setStart(PExpression node)
118    {
119        if(this._start_ != null)
120        {
121            this._start_.parent(null);
122        }
123
124        if(node != null)
125        {
126            if(node.parent() != null)
127            {
128                node.parent().removeChild(node);
129            }
130
131            node.parent(this);
132        }
133
134        this._start_ = node;
135    }
136
137    public PExpression getEnd()
138    {
139        return this._end_;
140    }
141
142    public void setEnd(PExpression node)
143    {
144        if(this._end_ != null)
145        {
146            this._end_.parent(null);
147        }
148
149        if(node != null)
150        {
151            if(node.parent() != null)
152            {
153                node.parent().removeChild(node);
154            }
155
156            node.parent(this);
157        }
158
159        this._end_ = node;
160    }
161
162    public PExpression getIncrement()
163    {
164        return this._increment_;
165    }
166
167    public void setIncrement(PExpression node)
168    {
169        if(this._increment_ != null)
170        {
171            this._increment_.parent(null);
172        }
173
174        if(node != null)
175        {
176            if(node.parent() != null)
177            {
178                node.parent().removeChild(node);
179            }
180
181            node.parent(this);
182        }
183
184        this._increment_ = node;
185    }
186
187    public PCommand getCommand()
188    {
189        return this._command_;
190    }
191
192    public void setCommand(PCommand node)
193    {
194        if(this._command_ != null)
195        {
196            this._command_.parent(null);
197        }
198
199        if(node != null)
200        {
201            if(node.parent() != null)
202            {
203                node.parent().removeChild(node);
204            }
205
206            node.parent(this);
207        }
208
209        this._command_ = node;
210    }
211
212    @Override
213    public String toString()
214    {
215        return ""
216            + toString(this._position_)
217            + toString(this._variable_)
218            + toString(this._start_)
219            + toString(this._end_)
220            + toString(this._increment_)
221            + toString(this._command_);
222    }
223
224    @Override
225    void removeChild(@SuppressWarnings("unused") Node child)
226    {
227        // Remove child
228        if(this._position_ == child)
229        {
230            this._position_ = null;
231            return;
232        }
233
234        if(this._variable_ == child)
235        {
236            this._variable_ = null;
237            return;
238        }
239
240        if(this._start_ == child)
241        {
242            this._start_ = null;
243            return;
244        }
245
246        if(this._end_ == child)
247        {
248            this._end_ = null;
249            return;
250        }
251
252        if(this._increment_ == child)
253        {
254            this._increment_ = null;
255            return;
256        }
257
258        if(this._command_ == child)
259        {
260            this._command_ = null;
261            return;
262        }
263
264        throw new RuntimeException("Not a child.");
265    }
266
267    @Override
268    void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
269    {
270        // Replace child
271        if(this._position_ == oldChild)
272        {
273            setPosition((PPosition) newChild);
274            return;
275        }
276
277        if(this._variable_ == oldChild)
278        {
279            setVariable((PVariable) newChild);
280            return;
281        }
282
283        if(this._start_ == oldChild)
284        {
285            setStart((PExpression) newChild);
286            return;
287        }
288
289        if(this._end_ == oldChild)
290        {
291            setEnd((PExpression) newChild);
292            return;
293        }
294
295        if(this._increment_ == oldChild)
296        {
297            setIncrement((PExpression) newChild);
298            return;
299        }
300
301        if(this._command_ == oldChild)
302        {
303            setCommand((PCommand) newChild);
304            return;
305        }
306
307        throw new RuntimeException("Not a child.");
308    }
309}
310