• 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 ASetCommand extends PCommand
9 {
10     private PPosition _position_;
11     private PVariable _variable_;
12     private PExpression _expression_;
13 
ASetCommand()14     public ASetCommand()
15     {
16         // Constructor
17     }
18 
ASetCommand( @uppressWarnings"hiding") PPosition _position_, @SuppressWarnings("hiding") PVariable _variable_, @SuppressWarnings("hiding") PExpression _expression_)19     public ASetCommand(
20         @SuppressWarnings("hiding") PPosition _position_,
21         @SuppressWarnings("hiding") PVariable _variable_,
22         @SuppressWarnings("hiding") PExpression _expression_)
23     {
24         // Constructor
25         setPosition(_position_);
26 
27         setVariable(_variable_);
28 
29         setExpression(_expression_);
30 
31     }
32 
33     @Override
clone()34     public Object clone()
35     {
36         return new ASetCommand(
37             cloneNode(this._position_),
38             cloneNode(this._variable_),
39             cloneNode(this._expression_));
40     }
41 
apply(Switch sw)42     public void apply(Switch sw)
43     {
44         ((Analysis) sw).caseASetCommand(this);
45     }
46 
getPosition()47     public PPosition getPosition()
48     {
49         return this._position_;
50     }
51 
setPosition(PPosition node)52     public void setPosition(PPosition node)
53     {
54         if(this._position_ != null)
55         {
56             this._position_.parent(null);
57         }
58 
59         if(node != null)
60         {
61             if(node.parent() != null)
62             {
63                 node.parent().removeChild(node);
64             }
65 
66             node.parent(this);
67         }
68 
69         this._position_ = node;
70     }
71 
getVariable()72     public PVariable getVariable()
73     {
74         return this._variable_;
75     }
76 
setVariable(PVariable node)77     public void setVariable(PVariable node)
78     {
79         if(this._variable_ != null)
80         {
81             this._variable_.parent(null);
82         }
83 
84         if(node != null)
85         {
86             if(node.parent() != null)
87             {
88                 node.parent().removeChild(node);
89             }
90 
91             node.parent(this);
92         }
93 
94         this._variable_ = node;
95     }
96 
getExpression()97     public PExpression getExpression()
98     {
99         return this._expression_;
100     }
101 
setExpression(PExpression node)102     public void setExpression(PExpression node)
103     {
104         if(this._expression_ != null)
105         {
106             this._expression_.parent(null);
107         }
108 
109         if(node != null)
110         {
111             if(node.parent() != null)
112             {
113                 node.parent().removeChild(node);
114             }
115 
116             node.parent(this);
117         }
118 
119         this._expression_ = node;
120     }
121 
122     @Override
toString()123     public String toString()
124     {
125         return ""
126             + toString(this._position_)
127             + toString(this._variable_)
128             + toString(this._expression_);
129     }
130 
131     @Override
removeChild(@uppressWarnings"unused") Node child)132     void removeChild(@SuppressWarnings("unused") Node child)
133     {
134         // Remove child
135         if(this._position_ == child)
136         {
137             this._position_ = null;
138             return;
139         }
140 
141         if(this._variable_ == child)
142         {
143             this._variable_ = null;
144             return;
145         }
146 
147         if(this._expression_ == child)
148         {
149             this._expression_ = null;
150             return;
151         }
152 
153         throw new RuntimeException("Not a child.");
154     }
155 
156     @Override
replaceChild(@uppressWarnings"unused") Node oldChild, @SuppressWarnings("unused") Node newChild)157     void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
158     {
159         // Replace child
160         if(this._position_ == oldChild)
161         {
162             setPosition((PPosition) newChild);
163             return;
164         }
165 
166         if(this._variable_ == oldChild)
167         {
168             setVariable((PVariable) newChild);
169             return;
170         }
171 
172         if(this._expression_ == oldChild)
173         {
174             setExpression((PExpression) newChild);
175             return;
176         }
177 
178         throw new RuntimeException("Not a child.");
179     }
180 }
181