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 ParConstructorDecl : {@link ConstructorDecl} ::= <span class="component">TypeArgument:{@link Access}*</span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.ast:10 017 */ 018 public class ParConstructorDecl 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 ParConstructorDecl clone() throws CloneNotSupportedException { 034 ParConstructorDecl node = (ParConstructorDecl)super.clone(); 035 node.genericConstructorDecl_computed = false; 036 node.genericConstructorDecl_value = null; 037 node.sourceConstructorDecl_computed = false; 038 node.sourceConstructorDecl_value = null; 039 node.in$Circle(false); 040 node.is$Final(false); 041 return node; 042 } 043 /** 044 * @apilevel internal 045 */ 046 @SuppressWarnings({"unchecked", "cast"}) 047 public ParConstructorDecl copy() { 048 049 try { 050 ParConstructorDecl node = (ParConstructorDecl) clone(); 051 node.parent = null; 052 if(children != null) 053 node.children = (ASTNode[]) children.clone(); 054 055 return node; 056 } catch (CloneNotSupportedException e) { 057 throw new Error("Error: clone not supported for " + getClass().getName()); 058 } 059 060 }/** 061 * Create a deep copy of the AST subtree at this node. 062 * The copy is dangling, i.e. has no parent. 063 * @return dangling copy of the subtree at this node 064 * @apilevel low-level 065 */ 066 @SuppressWarnings({"unchecked", "cast"}) 067 public ParConstructorDecl fullCopy() { 068 069 ParConstructorDecl tree = (ParConstructorDecl) copy(); 070 if (children != null) { 071 for (int i = 0; i < children.length; ++i) { 072 073 ASTNode child = (ASTNode) children[i]; 074 if(child != null) { 075 child = child.fullCopy(); 076 tree.setChild(child, i); 077 } 078 } 079 } 080 return tree; 081 082 } /** 083 * @ast method 084 * 085 */ 086 public ParConstructorDecl() { 087 super(); 088 089 090 } 091 /** 092 * Initializes the child array to the correct size. 093 * Initializes List and Opt nta children. 094 * @apilevel internal 095 * @ast method 096 * @ast method 097 * 098 */ 099 public void init$Children() { 100 children = new ASTNode[6]; 101 setChild(new List(), 1); 102 setChild(new List(), 2); 103 setChild(new Opt(), 3); 104 setChild(new List(), 5); 105 } 106 /** 107 * @ast method 108 * 109 */ 110 public ParConstructorDecl(Modifiers p0, String p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<Access> p6) { 111 setChild(p0, 0); 112 setID(p1); 113 setChild(p2, 1); 114 setChild(p3, 2); 115 setChild(p4, 3); 116 setChild(p5, 4); 117 setChild(p6, 5); 118 } 119 /** 120 * @ast method 121 * 122 */ 123 public ParConstructorDecl(Modifiers p0, beaver.Symbol p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<Access> p6) { 124 setChild(p0, 0); 125 setID(p1); 126 setChild(p2, 1); 127 setChild(p3, 2); 128 setChild(p4, 3); 129 setChild(p5, 4); 130 setChild(p6, 5); 131 } 132 /** 133 * @apilevel low-level 134 * @ast method 135 * 136 */ 137 protected int numChildren() { 138 return 6; 139 } 140 /** 141 * @apilevel internal 142 * @ast method 143 * 144 */ 145 public boolean mayHaveRewrite() { 146 return true; 147 } 148 /** 149 * Replaces the Modifiers child. 150 * @param node The new node to replace the Modifiers child. 151 * @apilevel high-level 152 * @ast method 153 * 154 */ 155 public void setModifiers(Modifiers node) { 156 setChild(node, 0); 157 } 158 /** 159 * Retrieves the Modifiers child. 160 * @return The current node used as the Modifiers child. 161 * @apilevel high-level 162 * @ast method 163 * 164 */ 165 public Modifiers getModifiers() { 166 return (Modifiers)getChild(0); 167 } 168 /** 169 * Retrieves the Modifiers child. 170 * <p><em>This method does not invoke AST transformations.</em></p> 171 * @return The current node used as the Modifiers child. 172 * @apilevel low-level 173 * @ast method 174 * 175 */ 176 public Modifiers getModifiersNoTransform() { 177 return (Modifiers)getChildNoTransform(0); 178 } 179 /** 180 * Replaces the lexeme ID. 181 * @param value The new value for the lexeme ID. 182 * @apilevel high-level 183 * @ast method 184 * 185 */ 186 public void setID(String value) { 187 tokenString_ID = value; 188 } 189 /** 190 * JastAdd-internal setter for lexeme ID using the Beaver parser. 191 * @apilevel internal 192 * @ast method 193 * 194 */ 195 public void setID(beaver.Symbol symbol) { 196 if(symbol.value != null && !(symbol.value instanceof String)) 197 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 198 tokenString_ID = (String)symbol.value; 199 IDstart = symbol.getStart(); 200 IDend = symbol.getEnd(); 201 } 202 /** 203 * Retrieves the value for the lexeme ID. 204 * @return The value for the lexeme ID. 205 * @apilevel high-level 206 * @ast method 207 * 208 */ 209 public String getID() { 210 return tokenString_ID != null ? tokenString_ID : ""; 211 } 212 /** 213 * Replaces the Parameter list. 214 * @param list The new list node to be used as the Parameter list. 215 * @apilevel high-level 216 * @ast method 217 * 218 */ 219 public void setParameterList(List<ParameterDeclaration> list) { 220 setChild(list, 1); 221 } 222 /** 223 * Retrieves the number of children in the Parameter list. 224 * @return Number of children in the Parameter list. 225 * @apilevel high-level 226 * @ast method 227 * 228 */ 229 public int getNumParameter() { 230 return getParameterList().getNumChild(); 231 } 232 /** 233 * Retrieves the number of children in the Parameter list. 234 * Calling this method will not trigger rewrites.. 235 * @return Number of children in the Parameter list. 236 * @apilevel low-level 237 * @ast method 238 * 239 */ 240 public int getNumParameterNoTransform() { 241 return getParameterListNoTransform().getNumChildNoTransform(); 242 } 243 /** 244 * Retrieves the element at index {@code i} in the Parameter list.. 245 * @param i Index of the element to return. 246 * @return The element at position {@code i} in the Parameter list. 247 * @apilevel high-level 248 * @ast method 249 * 250 */ 251 @SuppressWarnings({"unchecked", "cast"}) 252 public ParameterDeclaration getParameter(int i) { 253 return (ParameterDeclaration)getParameterList().getChild(i); 254 } 255 /** 256 * Append an element to the Parameter list. 257 * @param node The element to append to the Parameter list. 258 * @apilevel high-level 259 * @ast method 260 * 261 */ 262 public void addParameter(ParameterDeclaration node) { 263 List<ParameterDeclaration> list = (parent == null || state == null) ? getParameterListNoTransform() : getParameterList(); 264 list.addChild(node); 265 } 266 /** 267 * @apilevel low-level 268 * @ast method 269 * 270 */ 271 public void addParameterNoTransform(ParameterDeclaration node) { 272 List<ParameterDeclaration> list = getParameterListNoTransform(); 273 list.addChild(node); 274 } 275 /** 276 * Replaces the Parameter list element at index {@code i} with the new node {@code node}. 277 * @param node The new node to replace the old list element. 278 * @param i The list index of the node to be replaced. 279 * @apilevel high-level 280 * @ast method 281 * 282 */ 283 public void setParameter(ParameterDeclaration node, int i) { 284 List<ParameterDeclaration> list = getParameterList(); 285 list.setChild(node, i); 286 } 287 /** 288 * Retrieves the Parameter list. 289 * @return The node representing the Parameter list. 290 * @apilevel high-level 291 * @ast method 292 * 293 */ 294 public List<ParameterDeclaration> getParameters() { 295 return getParameterList(); 296 } 297 /** 298 * Retrieves the Parameter list. 299 * <p><em>This method does not invoke AST transformations.</em></p> 300 * @return The node representing the Parameter list. 301 * @apilevel low-level 302 * @ast method 303 * 304 */ 305 public List<ParameterDeclaration> getParametersNoTransform() { 306 return getParameterListNoTransform(); 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 @SuppressWarnings({"unchecked", "cast"}) 316 public List<ParameterDeclaration> getParameterList() { 317 List<ParameterDeclaration> list = (List<ParameterDeclaration>)getChild(1); 318 list.getNumChild(); 319 return list; 320 } 321 /** 322 * Retrieves the Parameter list. 323 * <p><em>This method does not invoke AST transformations.</em></p> 324 * @return The node representing the Parameter list. 325 * @apilevel low-level 326 * @ast method 327 * 328 */ 329 @SuppressWarnings({"unchecked", "cast"}) 330 public List<ParameterDeclaration> getParameterListNoTransform() { 331 return (List<ParameterDeclaration>)getChildNoTransform(1); 332 } 333 /** 334 * Replaces the Exception list. 335 * @param list The new list node to be used as the Exception list. 336 * @apilevel high-level 337 * @ast method 338 * 339 */ 340 public void setExceptionList(List<Access> list) { 341 setChild(list, 2); 342 } 343 /** 344 * Retrieves the number of children in the Exception list. 345 * @return Number of children in the Exception list. 346 * @apilevel high-level 347 * @ast method 348 * 349 */ 350 public int getNumException() { 351 return getExceptionList().getNumChild(); 352 } 353 /** 354 * Retrieves the number of children in the Exception list. 355 * Calling this method will not trigger rewrites.. 356 * @return Number of children in the Exception list. 357 * @apilevel low-level 358 * @ast method 359 * 360 */ 361 public int getNumExceptionNoTransform() { 362 return getExceptionListNoTransform().getNumChildNoTransform(); 363 } 364 /** 365 * Retrieves the element at index {@code i} in the Exception list.. 366 * @param i Index of the element to return. 367 * @return The element at position {@code i} in the Exception list. 368 * @apilevel high-level 369 * @ast method 370 * 371 */ 372 @SuppressWarnings({"unchecked", "cast"}) 373 public Access getException(int i) { 374 return (Access)getExceptionList().getChild(i); 375 } 376 /** 377 * Append an element to the Exception list. 378 * @param node The element to append to the Exception list. 379 * @apilevel high-level 380 * @ast method 381 * 382 */ 383 public void addException(Access node) { 384 List<Access> list = (parent == null || state == null) ? getExceptionListNoTransform() : getExceptionList(); 385 list.addChild(node); 386 } 387 /** 388 * @apilevel low-level 389 * @ast method 390 * 391 */ 392 public void addExceptionNoTransform(Access node) { 393 List<Access> list = getExceptionListNoTransform(); 394 list.addChild(node); 395 } 396 /** 397 * Replaces the Exception list element at index {@code i} with the new node {@code node}. 398 * @param node The new node to replace the old list element. 399 * @param i The list index of the node to be replaced. 400 * @apilevel high-level 401 * @ast method 402 * 403 */ 404 public void setException(Access node, int i) { 405 List<Access> list = getExceptionList(); 406 list.setChild(node, i); 407 } 408 /** 409 * Retrieves the Exception list. 410 * @return The node representing the Exception list. 411 * @apilevel high-level 412 * @ast method 413 * 414 */ 415 public List<Access> getExceptions() { 416 return getExceptionList(); 417 } 418 /** 419 * Retrieves the Exception list. 420 * <p><em>This method does not invoke AST transformations.</em></p> 421 * @return The node representing the Exception list. 422 * @apilevel low-level 423 * @ast method 424 * 425 */ 426 public List<Access> getExceptionsNoTransform() { 427 return getExceptionListNoTransform(); 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 @SuppressWarnings({"unchecked", "cast"}) 437 public List<Access> getExceptionList() { 438 List<Access> list = (List<Access>)getChild(2); 439 list.getNumChild(); 440 return list; 441 } 442 /** 443 * Retrieves the Exception list. 444 * <p><em>This method does not invoke AST transformations.</em></p> 445 * @return The node representing the Exception list. 446 * @apilevel low-level 447 * @ast method 448 * 449 */ 450 @SuppressWarnings({"unchecked", "cast"}) 451 public List<Access> getExceptionListNoTransform() { 452 return (List<Access>)getChildNoTransform(2); 453 } 454 /** 455 * Replaces the optional node for the ConstructorInvocation child. This is the {@code Opt} node containing the child ConstructorInvocation, not the actual child! 456 * @param opt The new node to be used as the optional node for the ConstructorInvocation child. 457 * @apilevel low-level 458 * @ast method 459 * 460 */ 461 public void setConstructorInvocationOpt(Opt<Stmt> opt) { 462 setChild(opt, 3); 463 } 464 /** 465 * Check whether the optional ConstructorInvocation child exists. 466 * @return {@code true} if the optional ConstructorInvocation child exists, {@code false} if it does not. 467 * @apilevel high-level 468 * @ast method 469 * 470 */ 471 public boolean hasConstructorInvocation() { 472 return getConstructorInvocationOpt().getNumChild() != 0; 473 } 474 /** 475 * Retrieves the (optional) ConstructorInvocation child. 476 * @return The ConstructorInvocation child, if it exists. Returns {@code null} otherwise. 477 * @apilevel low-level 478 * @ast method 479 * 480 */ 481 @SuppressWarnings({"unchecked", "cast"}) 482 public Stmt getConstructorInvocation() { 483 return (Stmt)getConstructorInvocationOpt().getChild(0); 484 } 485 /** 486 * Replaces the (optional) ConstructorInvocation child. 487 * @param node The new node to be used as the ConstructorInvocation child. 488 * @apilevel high-level 489 * @ast method 490 * 491 */ 492 public void setConstructorInvocation(Stmt node) { 493 getConstructorInvocationOpt().setChild(node, 0); 494 } 495 /** 496 * @apilevel low-level 497 * @ast method 498 * 499 */ 500 @SuppressWarnings({"unchecked", "cast"}) 501 public Opt<Stmt> getConstructorInvocationOpt() { 502 return (Opt<Stmt>)getChild(3); 503 } 504 /** 505 * Retrieves the optional node for child ConstructorInvocation. This is the {@code Opt} node containing the child ConstructorInvocation, not the actual child! 506 * <p><em>This method does not invoke AST transformations.</em></p> 507 * @return The optional node for child ConstructorInvocation. 508 * @apilevel low-level 509 * @ast method 510 * 511 */ 512 @SuppressWarnings({"unchecked", "cast"}) 513 public Opt<Stmt> getConstructorInvocationOptNoTransform() { 514 return (Opt<Stmt>)getChildNoTransform(3); 515 } 516 /** 517 * Replaces the Block child. 518 * @param node The new node to replace the Block child. 519 * @apilevel high-level 520 * @ast method 521 * 522 */ 523 public void setBlock(Block node) { 524 setChild(node, 4); 525 } 526 /** 527 * Retrieves the Block child. 528 * @return The current node used as the Block child. 529 * @apilevel high-level 530 * @ast method 531 * 532 */ 533 public Block getBlock() { 534 return (Block)getChild(4); 535 } 536 /** 537 * Retrieves the Block child. 538 * <p><em>This method does not invoke AST transformations.</em></p> 539 * @return The current node used as the Block child. 540 * @apilevel low-level 541 * @ast method 542 * 543 */ 544 public Block getBlockNoTransform() { 545 return (Block)getChildNoTransform(4); 546 } 547 /** 548 * Replaces the TypeArgument list. 549 * @param list The new list node to be used as the TypeArgument list. 550 * @apilevel high-level 551 * @ast method 552 * 553 */ 554 public void setTypeArgumentList(List<Access> list) { 555 setChild(list, 5); 556 } 557 /** 558 * Retrieves the number of children in the TypeArgument list. 559 * @return Number of children in the TypeArgument list. 560 * @apilevel high-level 561 * @ast method 562 * 563 */ 564 public int getNumTypeArgument() { 565 return getTypeArgumentList().getNumChild(); 566 } 567 /** 568 * Retrieves the number of children in the TypeArgument list. 569 * Calling this method will not trigger rewrites.. 570 * @return Number of children in the TypeArgument list. 571 * @apilevel low-level 572 * @ast method 573 * 574 */ 575 public int getNumTypeArgumentNoTransform() { 576 return getTypeArgumentListNoTransform().getNumChildNoTransform(); 577 } 578 /** 579 * Retrieves the element at index {@code i} in the TypeArgument list.. 580 * @param i Index of the element to return. 581 * @return The element at position {@code i} in the TypeArgument list. 582 * @apilevel high-level 583 * @ast method 584 * 585 */ 586 @SuppressWarnings({"unchecked", "cast"}) 587 public Access getTypeArgument(int i) { 588 return (Access)getTypeArgumentList().getChild(i); 589 } 590 /** 591 * Append an element to the TypeArgument list. 592 * @param node The element to append to the TypeArgument list. 593 * @apilevel high-level 594 * @ast method 595 * 596 */ 597 public void addTypeArgument(Access node) { 598 List<Access> list = (parent == null || state == null) ? getTypeArgumentListNoTransform() : getTypeArgumentList(); 599 list.addChild(node); 600 } 601 /** 602 * @apilevel low-level 603 * @ast method 604 * 605 */ 606 public void addTypeArgumentNoTransform(Access node) { 607 List<Access> list = getTypeArgumentListNoTransform(); 608 list.addChild(node); 609 } 610 /** 611 * Replaces the TypeArgument list element at index {@code i} with the new node {@code node}. 612 * @param node The new node to replace the old list element. 613 * @param i The list index of the node to be replaced. 614 * @apilevel high-level 615 * @ast method 616 * 617 */ 618 public void setTypeArgument(Access node, int i) { 619 List<Access> list = getTypeArgumentList(); 620 list.setChild(node, i); 621 } 622 /** 623 * Retrieves the TypeArgument list. 624 * @return The node representing the TypeArgument list. 625 * @apilevel high-level 626 * @ast method 627 * 628 */ 629 public List<Access> getTypeArguments() { 630 return getTypeArgumentList(); 631 } 632 /** 633 * Retrieves the TypeArgument list. 634 * <p><em>This method does not invoke AST transformations.</em></p> 635 * @return The node representing the TypeArgument list. 636 * @apilevel low-level 637 * @ast method 638 * 639 */ 640 public List<Access> getTypeArgumentsNoTransform() { 641 return getTypeArgumentListNoTransform(); 642 } 643 /** 644 * Retrieves the TypeArgument list. 645 * @return The node representing the TypeArgument list. 646 * @apilevel high-level 647 * @ast method 648 * 649 */ 650 @SuppressWarnings({"unchecked", "cast"}) 651 public List<Access> getTypeArgumentList() { 652 List<Access> list = (List<Access>)getChild(5); 653 list.getNumChild(); 654 return list; 655 } 656 /** 657 * Retrieves the TypeArgument list. 658 * <p><em>This method does not invoke AST transformations.</em></p> 659 * @return The node representing the TypeArgument list. 660 * @apilevel low-level 661 * @ast method 662 * 663 */ 664 @SuppressWarnings({"unchecked", "cast"}) 665 public List<Access> getTypeArgumentListNoTransform() { 666 return (List<Access>)getChildNoTransform(5); 667 } 668 /** 669 * @apilevel internal 670 */ 671 protected boolean genericConstructorDecl_computed = false; 672 /** 673 * @apilevel internal 674 */ 675 protected GenericConstructorDecl genericConstructorDecl_value; 676 /** 677 * @attribute syn 678 * @aspect GenericMethods 679 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.jrag:49 680 */ 681 @SuppressWarnings({"unchecked", "cast"}) 682 public GenericConstructorDecl genericConstructorDecl() { 683 if(genericConstructorDecl_computed) { 684 return genericConstructorDecl_value; 685 } 686 ASTNode$State state = state(); 687 int num = state.boundariesCrossed; 688 boolean isFinal = this.is$Final(); 689 genericConstructorDecl_value = genericConstructorDecl_compute(); 690 if(isFinal && num == state().boundariesCrossed){ genericConstructorDecl_computed = true; } 691 return genericConstructorDecl_value; 692 } 693 /** 694 * @apilevel internal 695 */ 696 private GenericConstructorDecl genericConstructorDecl_compute() { 697 if(getParent() != null && getParent().getParent() instanceof GenericConstructorDecl) 698 return (GenericConstructorDecl)getParent().getParent(); 699 return null; 700 } 701 /** 702 * @apilevel internal 703 */ 704 protected boolean sourceConstructorDecl_computed = false; 705 /** 706 * @apilevel internal 707 */ 708 protected ConstructorDecl sourceConstructorDecl_value; 709 /** 710 * @attribute syn 711 * @aspect SourceDeclarations 712 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.jrag:1516 713 */ 714 @SuppressWarnings({"unchecked", "cast"}) 715 public ConstructorDecl sourceConstructorDecl() { 716 if(sourceConstructorDecl_computed) { 717 return sourceConstructorDecl_value; 718 } 719 ASTNode$State state = state(); 720 int num = state.boundariesCrossed; 721 boolean isFinal = this.is$Final(); 722 sourceConstructorDecl_value = sourceConstructorDecl_compute(); 723 if(isFinal && num == state().boundariesCrossed){ sourceConstructorDecl_computed = true; } 724 return sourceConstructorDecl_value; 725 } 726 /** 727 * @apilevel internal 728 */ 729 private ConstructorDecl sourceConstructorDecl_compute() { return genericConstructorDecl().original().sourceConstructorDecl(); } 730 /** 731 * @apilevel internal 732 */ 733 public ASTNode rewriteTo() { 734 return super.rewriteTo(); 735 } 736 }