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 ConstructorDeclSubstituted : {@link ConstructorDecl} ::= <span class="component"><Original:ConstructorDecl></span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.ast:31 017 */ 018 public class ConstructorDeclSubstituted extends ConstructorDecl 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 ConstructorDeclSubstituted clone() throws CloneNotSupportedException { 034 ConstructorDeclSubstituted node = (ConstructorDeclSubstituted)super.clone(); 035 node.sourceConstructorDecl_computed = false; 036 node.sourceConstructorDecl_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 ConstructorDeclSubstituted copy() { 046 047 try { 048 ConstructorDeclSubstituted node = (ConstructorDeclSubstituted) 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 ConstructorDeclSubstituted fullCopy() { 066 067 ConstructorDeclSubstituted tree = (ConstructorDeclSubstituted) 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 * @aspect GenericsCodegen 083 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:45 084 */ 085 public ConstructorDecl createAccessor() { 086 return sourceConstructorDecl().createAccessor(); 087 } 088 /** 089 * @ast method 090 * @aspect GenericsCodegen 091 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:49 092 */ 093 protected TypeDecl createAnonymousJavaTypeDecl() { 094 return sourceConstructorDecl().createAnonymousJavaTypeDecl(); 095 } 096 /** 097 * @ast method 098 * @aspect GenericsCodegen 099 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:165 100 */ 101 public void emitInvokeConstructor(CodeGeneration gen) { 102 erasedConstructor().emitInvokeConstructor(gen); 103 } 104 /** 105 * @ast method 106 * 107 */ 108 public ConstructorDeclSubstituted() { 109 super(); 110 111 112 } 113 /** 114 * Initializes the child array to the correct size. 115 * Initializes List and Opt nta children. 116 * @apilevel internal 117 * @ast method 118 * @ast method 119 * 120 */ 121 public void init$Children() { 122 children = new ASTNode[5]; 123 setChild(new List(), 1); 124 setChild(new List(), 2); 125 setChild(new Opt(), 3); 126 } 127 /** 128 * @ast method 129 * 130 */ 131 public ConstructorDeclSubstituted(Modifiers p0, String p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, ConstructorDecl p6) { 132 setChild(p0, 0); 133 setID(p1); 134 setChild(p2, 1); 135 setChild(p3, 2); 136 setChild(p4, 3); 137 setChild(p5, 4); 138 setOriginal(p6); 139 } 140 /** 141 * @ast method 142 * 143 */ 144 public ConstructorDeclSubstituted(Modifiers p0, beaver.Symbol p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, ConstructorDecl p6) { 145 setChild(p0, 0); 146 setID(p1); 147 setChild(p2, 1); 148 setChild(p3, 2); 149 setChild(p4, 3); 150 setChild(p5, 4); 151 setOriginal(p6); 152 } 153 /** 154 * @apilevel low-level 155 * @ast method 156 * 157 */ 158 protected int numChildren() { 159 return 5; 160 } 161 /** 162 * @apilevel internal 163 * @ast method 164 * 165 */ 166 public boolean mayHaveRewrite() { 167 return true; 168 } 169 /** 170 * Replaces the Modifiers child. 171 * @param node The new node to replace the Modifiers child. 172 * @apilevel high-level 173 * @ast method 174 * 175 */ 176 public void setModifiers(Modifiers node) { 177 setChild(node, 0); 178 } 179 /** 180 * Retrieves the Modifiers child. 181 * @return The current node used as the Modifiers child. 182 * @apilevel high-level 183 * @ast method 184 * 185 */ 186 public Modifiers getModifiers() { 187 return (Modifiers)getChild(0); 188 } 189 /** 190 * Retrieves the Modifiers child. 191 * <p><em>This method does not invoke AST transformations.</em></p> 192 * @return The current node used as the Modifiers child. 193 * @apilevel low-level 194 * @ast method 195 * 196 */ 197 public Modifiers getModifiersNoTransform() { 198 return (Modifiers)getChildNoTransform(0); 199 } 200 /** 201 * Replaces the lexeme ID. 202 * @param value The new value for the lexeme ID. 203 * @apilevel high-level 204 * @ast method 205 * 206 */ 207 public void setID(String value) { 208 tokenString_ID = value; 209 } 210 /** 211 * JastAdd-internal setter for lexeme ID using the Beaver parser. 212 * @apilevel internal 213 * @ast method 214 * 215 */ 216 public void setID(beaver.Symbol symbol) { 217 if(symbol.value != null && !(symbol.value instanceof String)) 218 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 219 tokenString_ID = (String)symbol.value; 220 IDstart = symbol.getStart(); 221 IDend = symbol.getEnd(); 222 } 223 /** 224 * Retrieves the value for the lexeme ID. 225 * @return The value for the lexeme ID. 226 * @apilevel high-level 227 * @ast method 228 * 229 */ 230 public String getID() { 231 return tokenString_ID != null ? tokenString_ID : ""; 232 } 233 /** 234 * Replaces the Parameter list. 235 * @param list The new list node to be used as the Parameter list. 236 * @apilevel high-level 237 * @ast method 238 * 239 */ 240 public void setParameterList(List<ParameterDeclaration> list) { 241 setChild(list, 1); 242 } 243 /** 244 * Retrieves the number of children in the Parameter list. 245 * @return Number of children in the Parameter list. 246 * @apilevel high-level 247 * @ast method 248 * 249 */ 250 public int getNumParameter() { 251 return getParameterList().getNumChild(); 252 } 253 /** 254 * Retrieves the number of children in the Parameter list. 255 * Calling this method will not trigger rewrites.. 256 * @return Number of children in the Parameter list. 257 * @apilevel low-level 258 * @ast method 259 * 260 */ 261 public int getNumParameterNoTransform() { 262 return getParameterListNoTransform().getNumChildNoTransform(); 263 } 264 /** 265 * Retrieves the element at index {@code i} in the Parameter list.. 266 * @param i Index of the element to return. 267 * @return The element at position {@code i} in the Parameter list. 268 * @apilevel high-level 269 * @ast method 270 * 271 */ 272 @SuppressWarnings({"unchecked", "cast"}) 273 public ParameterDeclaration getParameter(int i) { 274 return (ParameterDeclaration)getParameterList().getChild(i); 275 } 276 /** 277 * Append an element to the Parameter list. 278 * @param node The element to append to the Parameter list. 279 * @apilevel high-level 280 * @ast method 281 * 282 */ 283 public void addParameter(ParameterDeclaration node) { 284 List<ParameterDeclaration> list = (parent == null || state == null) ? getParameterListNoTransform() : getParameterList(); 285 list.addChild(node); 286 } 287 /** 288 * @apilevel low-level 289 * @ast method 290 * 291 */ 292 public void addParameterNoTransform(ParameterDeclaration node) { 293 List<ParameterDeclaration> list = getParameterListNoTransform(); 294 list.addChild(node); 295 } 296 /** 297 * Replaces the Parameter list element at index {@code i} with the new node {@code node}. 298 * @param node The new node to replace the old list element. 299 * @param i The list index of the node to be replaced. 300 * @apilevel high-level 301 * @ast method 302 * 303 */ 304 public void setParameter(ParameterDeclaration node, int i) { 305 List<ParameterDeclaration> list = getParameterList(); 306 list.setChild(node, i); 307 } 308 /** 309 * Retrieves the Parameter list. 310 * @return The node representing the Parameter list. 311 * @apilevel high-level 312 * @ast method 313 * 314 */ 315 public List<ParameterDeclaration> getParameters() { 316 return getParameterList(); 317 } 318 /** 319 * Retrieves the Parameter list. 320 * <p><em>This method does not invoke AST transformations.</em></p> 321 * @return The node representing the Parameter list. 322 * @apilevel low-level 323 * @ast method 324 * 325 */ 326 public List<ParameterDeclaration> getParametersNoTransform() { 327 return getParameterListNoTransform(); 328 } 329 /** 330 * Retrieves the Parameter list. 331 * @return The node representing the Parameter list. 332 * @apilevel high-level 333 * @ast method 334 * 335 */ 336 @SuppressWarnings({"unchecked", "cast"}) 337 public List<ParameterDeclaration> getParameterList() { 338 List<ParameterDeclaration> list = (List<ParameterDeclaration>)getChild(1); 339 list.getNumChild(); 340 return list; 341 } 342 /** 343 * Retrieves the Parameter list. 344 * <p><em>This method does not invoke AST transformations.</em></p> 345 * @return The node representing the Parameter list. 346 * @apilevel low-level 347 * @ast method 348 * 349 */ 350 @SuppressWarnings({"unchecked", "cast"}) 351 public List<ParameterDeclaration> getParameterListNoTransform() { 352 return (List<ParameterDeclaration>)getChildNoTransform(1); 353 } 354 /** 355 * Replaces the Exception list. 356 * @param list The new list node to be used as the Exception list. 357 * @apilevel high-level 358 * @ast method 359 * 360 */ 361 public void setExceptionList(List<Access> list) { 362 setChild(list, 2); 363 } 364 /** 365 * Retrieves the number of children in the Exception list. 366 * @return Number of children in the Exception list. 367 * @apilevel high-level 368 * @ast method 369 * 370 */ 371 public int getNumException() { 372 return getExceptionList().getNumChild(); 373 } 374 /** 375 * Retrieves the number of children in the Exception list. 376 * Calling this method will not trigger rewrites.. 377 * @return Number of children in the Exception list. 378 * @apilevel low-level 379 * @ast method 380 * 381 */ 382 public int getNumExceptionNoTransform() { 383 return getExceptionListNoTransform().getNumChildNoTransform(); 384 } 385 /** 386 * Retrieves the element at index {@code i} in the Exception list.. 387 * @param i Index of the element to return. 388 * @return The element at position {@code i} in the Exception list. 389 * @apilevel high-level 390 * @ast method 391 * 392 */ 393 @SuppressWarnings({"unchecked", "cast"}) 394 public Access getException(int i) { 395 return (Access)getExceptionList().getChild(i); 396 } 397 /** 398 * Append an element to the Exception list. 399 * @param node The element to append to the Exception list. 400 * @apilevel high-level 401 * @ast method 402 * 403 */ 404 public void addException(Access node) { 405 List<Access> list = (parent == null || state == null) ? getExceptionListNoTransform() : getExceptionList(); 406 list.addChild(node); 407 } 408 /** 409 * @apilevel low-level 410 * @ast method 411 * 412 */ 413 public void addExceptionNoTransform(Access node) { 414 List<Access> list = getExceptionListNoTransform(); 415 list.addChild(node); 416 } 417 /** 418 * Replaces the Exception list element at index {@code i} with the new node {@code node}. 419 * @param node The new node to replace the old list element. 420 * @param i The list index of the node to be replaced. 421 * @apilevel high-level 422 * @ast method 423 * 424 */ 425 public void setException(Access node, int i) { 426 List<Access> list = getExceptionList(); 427 list.setChild(node, i); 428 } 429 /** 430 * Retrieves the Exception list. 431 * @return The node representing the Exception list. 432 * @apilevel high-level 433 * @ast method 434 * 435 */ 436 public List<Access> getExceptions() { 437 return getExceptionList(); 438 } 439 /** 440 * Retrieves the Exception list. 441 * <p><em>This method does not invoke AST transformations.</em></p> 442 * @return The node representing the Exception list. 443 * @apilevel low-level 444 * @ast method 445 * 446 */ 447 public List<Access> getExceptionsNoTransform() { 448 return getExceptionListNoTransform(); 449 } 450 /** 451 * Retrieves the Exception list. 452 * @return The node representing the Exception list. 453 * @apilevel high-level 454 * @ast method 455 * 456 */ 457 @SuppressWarnings({"unchecked", "cast"}) 458 public List<Access> getExceptionList() { 459 List<Access> list = (List<Access>)getChild(2); 460 list.getNumChild(); 461 return list; 462 } 463 /** 464 * Retrieves the Exception list. 465 * <p><em>This method does not invoke AST transformations.</em></p> 466 * @return The node representing the Exception list. 467 * @apilevel low-level 468 * @ast method 469 * 470 */ 471 @SuppressWarnings({"unchecked", "cast"}) 472 public List<Access> getExceptionListNoTransform() { 473 return (List<Access>)getChildNoTransform(2); 474 } 475 /** 476 * Replaces the optional node for the ConstructorInvocation child. This is the {@code Opt} node containing the child ConstructorInvocation, not the actual child! 477 * @param opt The new node to be used as the optional node for the ConstructorInvocation child. 478 * @apilevel low-level 479 * @ast method 480 * 481 */ 482 public void setConstructorInvocationOpt(Opt<Stmt> opt) { 483 setChild(opt, 3); 484 } 485 /** 486 * Check whether the optional ConstructorInvocation child exists. 487 * @return {@code true} if the optional ConstructorInvocation child exists, {@code false} if it does not. 488 * @apilevel high-level 489 * @ast method 490 * 491 */ 492 public boolean hasConstructorInvocation() { 493 return getConstructorInvocationOpt().getNumChild() != 0; 494 } 495 /** 496 * Retrieves the (optional) ConstructorInvocation child. 497 * @return The ConstructorInvocation child, if it exists. Returns {@code null} otherwise. 498 * @apilevel low-level 499 * @ast method 500 * 501 */ 502 @SuppressWarnings({"unchecked", "cast"}) 503 public Stmt getConstructorInvocation() { 504 return (Stmt)getConstructorInvocationOpt().getChild(0); 505 } 506 /** 507 * Replaces the (optional) ConstructorInvocation child. 508 * @param node The new node to be used as the ConstructorInvocation child. 509 * @apilevel high-level 510 * @ast method 511 * 512 */ 513 public void setConstructorInvocation(Stmt node) { 514 getConstructorInvocationOpt().setChild(node, 0); 515 } 516 /** 517 * @apilevel low-level 518 * @ast method 519 * 520 */ 521 @SuppressWarnings({"unchecked", "cast"}) 522 public Opt<Stmt> getConstructorInvocationOpt() { 523 return (Opt<Stmt>)getChild(3); 524 } 525 /** 526 * Retrieves the optional node for child ConstructorInvocation. This is the {@code Opt} node containing the child ConstructorInvocation, not the actual child! 527 * <p><em>This method does not invoke AST transformations.</em></p> 528 * @return The optional node for child ConstructorInvocation. 529 * @apilevel low-level 530 * @ast method 531 * 532 */ 533 @SuppressWarnings({"unchecked", "cast"}) 534 public Opt<Stmt> getConstructorInvocationOptNoTransform() { 535 return (Opt<Stmt>)getChildNoTransform(3); 536 } 537 /** 538 * Replaces the Block child. 539 * @param node The new node to replace the Block child. 540 * @apilevel high-level 541 * @ast method 542 * 543 */ 544 public void setBlock(Block node) { 545 setChild(node, 4); 546 } 547 /** 548 * Retrieves the Block child. 549 * @return The current node used as the Block child. 550 * @apilevel high-level 551 * @ast method 552 * 553 */ 554 public Block getBlock() { 555 return (Block)getChild(4); 556 } 557 /** 558 * Retrieves the Block child. 559 * <p><em>This method does not invoke AST transformations.</em></p> 560 * @return The current node used as the Block child. 561 * @apilevel low-level 562 * @ast method 563 * 564 */ 565 public Block getBlockNoTransform() { 566 return (Block)getChildNoTransform(4); 567 } 568 /** 569 * Replaces the lexeme Original. 570 * @param value The new value for the lexeme Original. 571 * @apilevel high-level 572 * @ast method 573 * 574 */ 575 public void setOriginal(ConstructorDecl value) { 576 tokenConstructorDecl_Original = value; 577 } 578 /** 579 * @apilevel internal 580 * @ast method 581 * 582 */ 583 584 /** 585 * @apilevel internal 586 */ 587 protected ConstructorDecl tokenConstructorDecl_Original; 588 /** 589 * Retrieves the value for the lexeme Original. 590 * @return The value for the lexeme Original. 591 * @apilevel high-level 592 * @ast method 593 * 594 */ 595 public ConstructorDecl getOriginal() { 596 return tokenConstructorDecl_Original; 597 } 598 /** 599 * @apilevel internal 600 */ 601 protected boolean sourceConstructorDecl_computed = false; 602 /** 603 * @apilevel internal 604 */ 605 protected ConstructorDecl sourceConstructorDecl_value; 606 /** 607 * @attribute syn 608 * @aspect SourceDeclarations 609 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1517 610 */ 611 @SuppressWarnings({"unchecked", "cast"}) 612 public ConstructorDecl sourceConstructorDecl() { 613 if(sourceConstructorDecl_computed) { 614 return sourceConstructorDecl_value; 615 } 616 ASTNode$State state = state(); 617 int num = state.boundariesCrossed; 618 boolean isFinal = this.is$Final(); 619 sourceConstructorDecl_value = sourceConstructorDecl_compute(); 620 if(isFinal && num == state().boundariesCrossed){ sourceConstructorDecl_computed = true; } 621 return sourceConstructorDecl_value; 622 } 623 /** 624 * @apilevel internal 625 */ 626 private ConstructorDecl sourceConstructorDecl_compute() { return getOriginal().sourceConstructorDecl(); } 627 /** 628 * @attribute syn 629 * @aspect GenericsCodegen 630 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:168 631 */ 632 public ConstructorDecl erasedConstructor() { 633 ASTNode$State state = state(); 634 try { return getOriginal().erasedConstructor(); } 635 finally { 636 } 637 } 638 /** 639 * @apilevel internal 640 */ 641 public ASTNode rewriteTo() { 642 return super.rewriteTo(); 643 } 644 }