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 AWithCommand extends PCommand 9 { 10 private PPosition _position_; 11 private PVariable _variable_; 12 private PExpression _expression_; 13 private PCommand _command_; 14 15 public AWithCommand() 16 { 17 // Constructor 18 } 19 20 public AWithCommand( 21 @SuppressWarnings("hiding") PPosition _position_, 22 @SuppressWarnings("hiding") PVariable _variable_, 23 @SuppressWarnings("hiding") PExpression _expression_, 24 @SuppressWarnings("hiding") PCommand _command_) 25 { 26 // Constructor 27 setPosition(_position_); 28 29 setVariable(_variable_); 30 31 setExpression(_expression_); 32 33 setCommand(_command_); 34 35 } 36 37 @Override 38 public Object clone() 39 { 40 return new AWithCommand( 41 cloneNode(this._position_), 42 cloneNode(this._variable_), 43 cloneNode(this._expression_), 44 cloneNode(this._command_)); 45 } 46 47 public void apply(Switch sw) 48 { 49 ((Analysis) sw).caseAWithCommand(this); 50 } 51 52 public PPosition getPosition() 53 { 54 return this._position_; 55 } 56 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 77 public PVariable getVariable() 78 { 79 return this._variable_; 80 } 81 82 public void setVariable(PVariable node) 83 { 84 if(this._variable_ != null) 85 { 86 this._variable_.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._variable_ = node; 100 } 101 102 public PExpression getExpression() 103 { 104 return this._expression_; 105 } 106 107 public void setExpression(PExpression node) 108 { 109 if(this._expression_ != null) 110 { 111 this._expression_.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._expression_ = node; 125 } 126 127 public PCommand getCommand() 128 { 129 return this._command_; 130 } 131 132 public void setCommand(PCommand node) 133 { 134 if(this._command_ != null) 135 { 136 this._command_.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._command_ = node; 150 } 151 152 @Override 153 public String toString() 154 { 155 return "" 156 + toString(this._position_) 157 + toString(this._variable_) 158 + toString(this._expression_) 159 + toString(this._command_); 160 } 161 162 @Override 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._variable_ == child) 173 { 174 this._variable_ = null; 175 return; 176 } 177 178 if(this._expression_ == child) 179 { 180 this._expression_ = null; 181 return; 182 } 183 184 if(this._command_ == child) 185 { 186 this._command_ = null; 187 return; 188 } 189 190 throw new RuntimeException("Not a child."); 191 } 192 193 @Override 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._variable_ == oldChild) 204 { 205 setVariable((PVariable) newChild); 206 return; 207 } 208 209 if(this._expression_ == oldChild) 210 { 211 setExpression((PExpression) newChild); 212 return; 213 } 214 215 if(this._command_ == oldChild) 216 { 217 setCommand((PCommand) newChild); 218 return; 219 } 220 221 throw new RuntimeException("Not a child."); 222 } 223 } 224