001 /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */ 002 package AST; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.*; 007 import beaver.*; 008 import java.util.ArrayList; 009 import java.util.zip.*; 010 import java.io.*; 011 import java.io.FileNotFoundException; 012 import java.util.Collection; 013 /** 014 * @production FieldDeclarationSubstituted : {@link FieldDeclaration} ::= <span class="component"><Original:FieldDeclaration></span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.ast:32 017 */ 018 public class FieldDeclarationSubstituted extends FieldDeclaration implements Cloneable { 019 /** 020 * @apilevel low-level 021 */ 022 public void flushCache() { 023 } 024 /** 025 * @apilevel internal 026 */ 027 public void flushCollectionCache() { 028 } 029 /** 030 * @apilevel internal 031 */ 032 @SuppressWarnings({"unchecked", "cast"}) 033 public FieldDeclarationSubstituted clone() throws CloneNotSupportedException { 034 FieldDeclarationSubstituted node = (FieldDeclarationSubstituted)super.clone(); 035 node.sourceVariableDecl_computed = false; 036 node.sourceVariableDecl_value = null; 037 node.in$Circle(false); 038 node.is$Final(false); 039 return node; 040 } 041 /** 042 * @apilevel internal 043 */ 044 @SuppressWarnings({"unchecked", "cast"}) 045 public FieldDeclarationSubstituted copy() { 046 047 try { 048 FieldDeclarationSubstituted node = (FieldDeclarationSubstituted) clone(); 049 node.parent = null; 050 if(children != null) 051 node.children = (ASTNode[]) children.clone(); 052 053 return node; 054 } catch (CloneNotSupportedException e) { 055 throw new Error("Error: clone not supported for " + getClass().getName()); 056 } 057 058 }/** 059 * Create a deep copy of the AST subtree at this node. 060 * The copy is dangling, i.e. has no parent. 061 * @return dangling copy of the subtree at this node 062 * @apilevel low-level 063 */ 064 @SuppressWarnings({"unchecked", "cast"}) 065 public FieldDeclarationSubstituted fullCopy() { 066 067 FieldDeclarationSubstituted tree = (FieldDeclarationSubstituted) copy(); 068 if (children != null) { 069 for (int i = 0; i < children.length; ++i) { 070 071 ASTNode child = (ASTNode) children[i]; 072 if(child != null) { 073 child = child.fullCopy(); 074 tree.setChild(child, i); 075 } 076 } 077 } 078 return tree; 079 080 } /** 081 * @ast method 082 * 083 */ 084 public FieldDeclarationSubstituted() { 085 super(); 086 087 088 } 089 /** 090 * Initializes the child array to the correct size. 091 * Initializes List and Opt nta children. 092 * @apilevel internal 093 * @ast method 094 * @ast method 095 * 096 */ 097 public void init$Children() { 098 children = new ASTNode[3]; 099 setChild(new Opt(), 2); 100 } 101 /** 102 * @ast method 103 * 104 */ 105 public FieldDeclarationSubstituted(Modifiers p0, Access p1, String p2, Opt<Expr> p3, FieldDeclaration p4) { 106 setChild(p0, 0); 107 setChild(p1, 1); 108 setID(p2); 109 setChild(p3, 2); 110 setOriginal(p4); 111 } 112 /** 113 * @ast method 114 * 115 */ 116 public FieldDeclarationSubstituted(Modifiers p0, Access p1, beaver.Symbol p2, Opt<Expr> p3, FieldDeclaration p4) { 117 setChild(p0, 0); 118 setChild(p1, 1); 119 setID(p2); 120 setChild(p3, 2); 121 setOriginal(p4); 122 } 123 /** 124 * @apilevel low-level 125 * @ast method 126 * 127 */ 128 protected int numChildren() { 129 return 3; 130 } 131 /** 132 * @apilevel internal 133 * @ast method 134 * 135 */ 136 public boolean mayHaveRewrite() { 137 return false; 138 } 139 /** 140 * Replaces the Modifiers child. 141 * @param node The new node to replace the Modifiers child. 142 * @apilevel high-level 143 * @ast method 144 * 145 */ 146 public void setModifiers(Modifiers node) { 147 setChild(node, 0); 148 } 149 /** 150 * Retrieves the Modifiers child. 151 * @return The current node used as the Modifiers child. 152 * @apilevel high-level 153 * @ast method 154 * 155 */ 156 public Modifiers getModifiers() { 157 return (Modifiers)getChild(0); 158 } 159 /** 160 * Retrieves the Modifiers child. 161 * <p><em>This method does not invoke AST transformations.</em></p> 162 * @return The current node used as the Modifiers child. 163 * @apilevel low-level 164 * @ast method 165 * 166 */ 167 public Modifiers getModifiersNoTransform() { 168 return (Modifiers)getChildNoTransform(0); 169 } 170 /** 171 * Replaces the TypeAccess child. 172 * @param node The new node to replace the TypeAccess child. 173 * @apilevel high-level 174 * @ast method 175 * 176 */ 177 public void setTypeAccess(Access node) { 178 setChild(node, 1); 179 } 180 /** 181 * Retrieves the TypeAccess child. 182 * @return The current node used as the TypeAccess child. 183 * @apilevel high-level 184 * @ast method 185 * 186 */ 187 public Access getTypeAccess() { 188 return (Access)getChild(1); 189 } 190 /** 191 * Retrieves the TypeAccess child. 192 * <p><em>This method does not invoke AST transformations.</em></p> 193 * @return The current node used as the TypeAccess child. 194 * @apilevel low-level 195 * @ast method 196 * 197 */ 198 public Access getTypeAccessNoTransform() { 199 return (Access)getChildNoTransform(1); 200 } 201 /** 202 * Replaces the lexeme ID. 203 * @param value The new value for the lexeme ID. 204 * @apilevel high-level 205 * @ast method 206 * 207 */ 208 public void setID(String value) { 209 tokenString_ID = value; 210 } 211 /** 212 * JastAdd-internal setter for lexeme ID using the Beaver parser. 213 * @apilevel internal 214 * @ast method 215 * 216 */ 217 public void setID(beaver.Symbol symbol) { 218 if(symbol.value != null && !(symbol.value instanceof String)) 219 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 220 tokenString_ID = (String)symbol.value; 221 IDstart = symbol.getStart(); 222 IDend = symbol.getEnd(); 223 } 224 /** 225 * Retrieves the value for the lexeme ID. 226 * @return The value for the lexeme ID. 227 * @apilevel high-level 228 * @ast method 229 * 230 */ 231 public String getID() { 232 return tokenString_ID != null ? tokenString_ID : ""; 233 } 234 /** 235 * Replaces the optional node for the Init child. This is the {@code Opt} node containing the child Init, not the actual child! 236 * @param opt The new node to be used as the optional node for the Init child. 237 * @apilevel low-level 238 * @ast method 239 * 240 */ 241 public void setInitOpt(Opt<Expr> opt) { 242 setChild(opt, 2); 243 } 244 /** 245 * Check whether the optional Init child exists. 246 * @return {@code true} if the optional Init child exists, {@code false} if it does not. 247 * @apilevel high-level 248 * @ast method 249 * 250 */ 251 public boolean hasInit() { 252 return getInitOpt().getNumChild() != 0; 253 } 254 /** 255 * Retrieves the (optional) Init child. 256 * @return The Init child, if it exists. Returns {@code null} otherwise. 257 * @apilevel low-level 258 * @ast method 259 * 260 */ 261 @SuppressWarnings({"unchecked", "cast"}) 262 public Expr getInit() { 263 return (Expr)getInitOpt().getChild(0); 264 } 265 /** 266 * Replaces the (optional) Init child. 267 * @param node The new node to be used as the Init child. 268 * @apilevel high-level 269 * @ast method 270 * 271 */ 272 public void setInit(Expr node) { 273 getInitOpt().setChild(node, 0); 274 } 275 /** 276 * @apilevel low-level 277 * @ast method 278 * 279 */ 280 @SuppressWarnings({"unchecked", "cast"}) 281 public Opt<Expr> getInitOpt() { 282 return (Opt<Expr>)getChild(2); 283 } 284 /** 285 * Retrieves the optional node for child Init. This is the {@code Opt} node containing the child Init, not the actual child! 286 * <p><em>This method does not invoke AST transformations.</em></p> 287 * @return The optional node for child Init. 288 * @apilevel low-level 289 * @ast method 290 * 291 */ 292 @SuppressWarnings({"unchecked", "cast"}) 293 public Opt<Expr> getInitOptNoTransform() { 294 return (Opt<Expr>)getChildNoTransform(2); 295 } 296 /** 297 * Replaces the lexeme Original. 298 * @param value The new value for the lexeme Original. 299 * @apilevel high-level 300 * @ast method 301 * 302 */ 303 public void setOriginal(FieldDeclaration value) { 304 tokenFieldDeclaration_Original = value; 305 } 306 /** 307 * @apilevel internal 308 * @ast method 309 * 310 */ 311 312 /** 313 * @apilevel internal 314 */ 315 protected FieldDeclaration tokenFieldDeclaration_Original; 316 /** 317 * Retrieves the value for the lexeme Original. 318 * @return The value for the lexeme Original. 319 * @apilevel high-level 320 * @ast method 321 * 322 */ 323 public FieldDeclaration getOriginal() { 324 return tokenFieldDeclaration_Original; 325 } 326 /** 327 * @apilevel internal 328 */ 329 protected boolean sourceVariableDecl_computed = false; 330 /** 331 * @apilevel internal 332 */ 333 protected Variable sourceVariableDecl_value; 334 /** 335 * @attribute syn 336 * @aspect SourceDeclarations 337 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1522 338 */ 339 @SuppressWarnings({"unchecked", "cast"}) 340 public Variable sourceVariableDecl() { 341 if(sourceVariableDecl_computed) { 342 return sourceVariableDecl_value; 343 } 344 ASTNode$State state = state(); 345 int num = state.boundariesCrossed; 346 boolean isFinal = this.is$Final(); 347 sourceVariableDecl_value = sourceVariableDecl_compute(); 348 if(isFinal && num == state().boundariesCrossed){ sourceVariableDecl_computed = true; } 349 return sourceVariableDecl_value; 350 } 351 /** 352 * @apilevel internal 353 */ 354 private Variable sourceVariableDecl_compute() { return getOriginal().sourceVariableDecl(); } 355 /** 356 * @attribute syn 357 * @aspect GenericsCodegen 358 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:53 359 */ 360 public FieldDeclaration erasedField() { 361 ASTNode$State state = state(); 362 try { return getOriginal().erasedField(); } 363 finally { 364 } 365 } 366 /** 367 * @apilevel internal 368 */ 369 public ASTNode rewriteTo() { 370 return super.rewriteTo(); 371 } 372 }