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 ALoopCommand extends PCommand
9{
10    private PPosition _position_;
11    private PVariable _variable_;
12    private PExpression _start_;
13    private PExpression _end_;
14    private PCommand _command_;
15
16    public ALoopCommand()
17    {
18        // Constructor
19    }
20
21    public ALoopCommand(
22        @SuppressWarnings("hiding") PPosition _position_,
23        @SuppressWarnings("hiding") PVariable _variable_,
24        @SuppressWarnings("hiding") PExpression _start_,
25        @SuppressWarnings("hiding") PExpression _end_,
26        @SuppressWarnings("hiding") PCommand _command_)
27    {
28        // Constructor
29        setPosition(_position_);
30
31        setVariable(_variable_);
32
33        setStart(_start_);
34
35        setEnd(_end_);
36
37        setCommand(_command_);
38
39    }
40
41    @Override
42    public Object clone()
43    {
44        return new ALoopCommand(
45            cloneNode(this._position_),
46            cloneNode(this._variable_),
47            cloneNode(this._start_),
48            cloneNode(this._end_),
49            cloneNode(this._command_));
50    }
51
52    public void apply(Switch sw)
53    {
54        ((Analysis) sw).caseALoopCommand(this);
55    }
56
57    public PPosition getPosition()
58    {
59        return this._position_;
60    }
61
62    public void setPosition(PPosition node)
63    {
64        if(this._position_ != null)
65        {
66            this._position_.parent(null);
67        }
68
69        if(node != null)
70        {
71            if(node.parent() != null)
72            {
73                node.parent().removeChild(node);
74            }
75
76            node.parent(this);
77        }
78
79        this._position_ = node;
80    }
81
82    public PVariable getVariable()
83    {
84        return this._variable_;
85    }
86
87    public void setVariable(PVariable node)
88    {
89        if(this._variable_ != null)
90        {
91            this._variable_.parent(null);
92        }
93
94        if(node != null)
95        {
96            if(node.parent() != null)
97            {
98                node.parent().removeChild(node);
99            }
100
101            node.parent(this);
102        }
103
104        this._variable_ = node;
105    }
106
107    public PExpression getStart()
108    {
109        return this._start_;
110    }
111
112    public void setStart(PExpression node)
113    {
114        if(this._start_ != null)
115        {
116            this._start_.parent(null);
117        }
118
119        if(node != null)
120        {
121            if(node.parent() != null)
122            {
123                node.parent().removeChild(node);
124            }
125
126            node.parent(this);
127        }
128
129        this._start_ = node;
130    }
131
132    public PExpression getEnd()
133    {
134        return this._end_;
135    }
136
137    public void setEnd(PExpression node)
138    {
139        if(this._end_ != null)
140        {
141            this._end_.parent(null);
142        }
143
144        if(node != null)
145        {
146            if(node.parent() != null)
147            {
148                node.parent().removeChild(node);
149            }
150
151            node.parent(this);
152        }
153
154        this._end_ = node;
155    }
156
157    public PCommand getCommand()
158    {
159        return this._command_;
160    }
161
162    public void setCommand(PCommand node)
163    {
164        if(this._command_ != null)
165        {
166            this._command_.parent(null);
167        }
168
169        if(node != null)
170        {
171            if(node.parent() != null)
172            {
173                node.parent().removeChild(node);
174            }
175
176            node.parent(this);
177        }
178
179        this._command_ = node;
180    }
181
182    @Override
183    public String toString()
184    {
185        return ""
186            + toString(this._position_)
187            + toString(this._variable_)
188            + toString(this._start_)
189            + toString(this._end_)
190            + toString(this._command_);
191    }
192
193    @Override
194    void removeChild(@SuppressWarnings("unused") Node child)
195    {
196        // Remove child
197        if(this._position_ == child)
198        {
199            this._position_ = null;
200            return;
201        }
202
203        if(this._variable_ == child)
204        {
205            this._variable_ = null;
206            return;
207        }
208
209        if(this._start_ == child)
210        {
211            this._start_ = null;
212            return;
213        }
214
215        if(this._end_ == child)
216        {
217            this._end_ = null;
218            return;
219        }
220
221        if(this._command_ == child)
222        {
223            this._command_ = null;
224            return;
225        }
226
227        throw new RuntimeException("Not a child.");
228    }
229
230    @Override
231    void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
232    {
233        // Replace child
234        if(this._position_ == oldChild)
235        {
236            setPosition((PPosition) newChild);
237            return;
238        }
239
240        if(this._variable_ == oldChild)
241        {
242            setVariable((PVariable) newChild);
243            return;
244        }
245
246        if(this._start_ == oldChild)
247        {
248            setStart((PExpression) newChild);
249            return;
250        }
251
252        if(this._end_ == oldChild)
253        {
254            setEnd((PExpression) newChild);
255            return;
256        }
257
258        if(this._command_ == oldChild)
259        {
260            setCommand((PCommand) newChild);
261            return;
262        }
263
264        throw new RuntimeException("Not a child.");
265    }
266}
267