001 /* This file was generated with JastAdd2 (http://jastadd.org) version 2.1.13-12-g880e696 */ 002 package org.extendj.ast; 003 004 import java.util.HashSet; 005 import java.io.File; 006 import java.util.Set; 007 import java.util.Collections; 008 import java.util.Collection; 009 import java.util.ArrayList; 010 import beaver.*; 011 import java.util.*; 012 import java.io.ByteArrayOutputStream; 013 import java.io.PrintStream; 014 import java.lang.reflect.InvocationTargetException; 015 import java.lang.reflect.Method; 016 import org.jastadd.util.*; 017 import java.util.zip.*; 018 import java.io.*; 019 import org.jastadd.util.PrettyPrintable; 020 import org.jastadd.util.PrettyPrinter; 021 import java.io.FileNotFoundException; 022 import java.io.BufferedInputStream; 023 import java.io.DataInputStream; 024 /** 025 * @ast node 026 * @declaredat /home/jesper/git/extendj/java5/grammar/GenericMethods.ast:12 027 * @production RawConstructorDecl : {@link ParConstructorDecl}; 028 029 */ 030 public class RawConstructorDecl extends ParConstructorDecl implements Cloneable { 031 /** 032 * @declaredat ASTNode:1 033 */ 034 public RawConstructorDecl() { 035 super(); 036 } 037 /** 038 * Initializes the child array to the correct size. 039 * Initializes List and Opt nta children. 040 * @apilevel internal 041 * @ast method 042 * @declaredat ASTNode:10 043 */ 044 public void init$Children() { 045 children = new ASTNode[7]; 046 setChild(new List(), 1); 047 setChild(new List(), 2); 048 setChild(new Opt(), 3); 049 setChild(new List(), 5); 050 } 051 /** 052 * @declaredat ASTNode:17 053 */ 054 public RawConstructorDecl(Modifiers p0, String p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<Access> p6, GenericConstructorDecl p7) { 055 setChild(p0, 0); 056 setID(p1); 057 setChild(p2, 1); 058 setChild(p3, 2); 059 setChild(p4, 3); 060 setChild(p5, 4); 061 setChild(p6, 5); 062 setGenericConstructorDecl(p7); 063 } 064 /** 065 * @declaredat ASTNode:27 066 */ 067 public RawConstructorDecl(Modifiers p0, beaver.Symbol p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<Access> p6, GenericConstructorDecl p7) { 068 setChild(p0, 0); 069 setID(p1); 070 setChild(p2, 1); 071 setChild(p3, 2); 072 setChild(p4, 3); 073 setChild(p5, 4); 074 setChild(p6, 5); 075 setGenericConstructorDecl(p7); 076 } 077 /** 078 * @apilevel low-level 079 * @declaredat ASTNode:40 080 */ 081 protected int numChildren() { 082 return 6; 083 } 084 /** 085 * @apilevel internal 086 * @declaredat ASTNode:46 087 */ 088 public boolean mayHaveRewrite() { 089 return false; 090 } 091 /** 092 * @apilevel internal 093 * @declaredat ASTNode:52 094 */ 095 public void flushAttrCache() { 096 super.flushAttrCache(); 097 } 098 /** 099 * @apilevel internal 100 * @declaredat ASTNode:58 101 */ 102 public void flushCollectionCache() { 103 super.flushCollectionCache(); 104 } 105 /** 106 * @apilevel internal 107 * @declaredat ASTNode:64 108 */ 109 public void flushRewriteCache() { 110 super.flushRewriteCache(); 111 } 112 /** 113 * @apilevel internal 114 * @declaredat ASTNode:70 115 */ 116 public RawConstructorDecl clone() throws CloneNotSupportedException { 117 RawConstructorDecl node = (RawConstructorDecl) super.clone(); 118 return node; 119 } 120 /** 121 * @apilevel internal 122 * @declaredat ASTNode:77 123 */ 124 public RawConstructorDecl copy() { 125 try { 126 RawConstructorDecl node = (RawConstructorDecl) clone(); 127 node.parent = null; 128 if (children != null) { 129 node.children = (ASTNode[]) children.clone(); 130 } 131 return node; 132 } catch (CloneNotSupportedException e) { 133 throw new Error("Error: clone not supported for " + getClass().getName()); 134 } 135 } 136 /** 137 * Create a deep copy of the AST subtree at this node. 138 * The copy is dangling, i.e. has no parent. 139 * @return dangling copy of the subtree at this node 140 * @apilevel low-level 141 * @deprecated Please use treeCopy or treeCopyNoTransform instead 142 * @declaredat ASTNode:96 143 */ 144 @Deprecated 145 public RawConstructorDecl fullCopy() { 146 return treeCopyNoTransform(); 147 } 148 /** 149 * Create a deep copy of the AST subtree at this node. 150 * The copy is dangling, i.e. has no parent. 151 * @return dangling copy of the subtree at this node 152 * @apilevel low-level 153 * @declaredat ASTNode:106 154 */ 155 public RawConstructorDecl treeCopyNoTransform() { 156 RawConstructorDecl tree = (RawConstructorDecl) copy(); 157 if (children != null) { 158 for (int i = 0; i < children.length; ++i) { 159 switch (i) { 160 case 6: 161 tree.children[i] = null; 162 continue; 163 } 164 ASTNode child = (ASTNode) children[i]; 165 if (child != null) { 166 child = child.treeCopyNoTransform(); 167 tree.setChild(child, i); 168 } 169 } 170 } 171 return tree; 172 } 173 /** 174 * Create a deep copy of the AST subtree at this node. 175 * The subtree of this node is traversed to trigger rewrites before copy. 176 * The copy is dangling, i.e. has no parent. 177 * @return dangling copy of the subtree at this node 178 * @apilevel low-level 179 * @declaredat ASTNode:131 180 */ 181 public RawConstructorDecl treeCopy() { 182 doFullTraversal(); 183 return treeCopyNoTransform(); 184 } 185 /** 186 * @apilevel internal 187 * @declaredat ASTNode:138 188 */ 189 protected boolean is$Equal(ASTNode node) { 190 return super.is$Equal(node) && (tokenString_ID == ((RawConstructorDecl)node).tokenString_ID) && (tokenGenericConstructorDecl_GenericConstructorDecl == ((RawConstructorDecl)node).tokenGenericConstructorDecl_GenericConstructorDecl); 191 } 192 /** 193 * Replaces the Modifiers child. 194 * @param node The new node to replace the Modifiers child. 195 * @apilevel high-level 196 */ 197 public void setModifiers(Modifiers node) { 198 setChild(node, 0); 199 } 200 /** 201 * Retrieves the Modifiers child. 202 * @return The current node used as the Modifiers child. 203 * @apilevel high-level 204 */ 205 @ASTNodeAnnotation.Child(name="Modifiers") 206 public Modifiers getModifiers() { 207 return (Modifiers) getChild(0); 208 } 209 /** 210 * Retrieves the Modifiers child. 211 * <p><em>This method does not invoke AST transformations.</em></p> 212 * @return The current node used as the Modifiers child. 213 * @apilevel low-level 214 */ 215 public Modifiers getModifiersNoTransform() { 216 return (Modifiers) getChildNoTransform(0); 217 } 218 /** 219 * Replaces the lexeme ID. 220 * @param value The new value for the lexeme ID. 221 * @apilevel high-level 222 */ 223 public void setID(String value) { 224 tokenString_ID = value; 225 } 226 /** 227 * JastAdd-internal setter for lexeme ID using the Beaver parser. 228 * @param symbol Symbol containing the new value for the lexeme ID 229 * @apilevel internal 230 */ 231 public void setID(beaver.Symbol symbol) { 232 if (symbol.value != null && !(symbol.value instanceof String)) 233 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 234 tokenString_ID = (String)symbol.value; 235 IDstart = symbol.getStart(); 236 IDend = symbol.getEnd(); 237 } 238 /** 239 * Retrieves the value for the lexeme ID. 240 * @return The value for the lexeme ID. 241 * @apilevel high-level 242 */ 243 @ASTNodeAnnotation.Token(name="ID") 244 public String getID() { 245 return tokenString_ID != null ? tokenString_ID : ""; 246 } 247 /** 248 * Replaces the Parameter list. 249 * @param list The new list node to be used as the Parameter list. 250 * @apilevel high-level 251 */ 252 public void setParameterList(List<ParameterDeclaration> list) { 253 setChild(list, 1); 254 } 255 /** 256 * Retrieves the number of children in the Parameter list. 257 * @return Number of children in the Parameter list. 258 * @apilevel high-level 259 */ 260 public int getNumParameter() { 261 return getParameterList().getNumChild(); 262 } 263 /** 264 * Retrieves the number of children in the Parameter list. 265 * Calling this method will not trigger rewrites. 266 * @return Number of children in the Parameter list. 267 * @apilevel low-level 268 */ 269 public int getNumParameterNoTransform() { 270 return getParameterListNoTransform().getNumChildNoTransform(); 271 } 272 /** 273 * Retrieves the element at index {@code i} in the Parameter list. 274 * @param i Index of the element to return. 275 * @return The element at position {@code i} in the Parameter list. 276 * @apilevel high-level 277 */ 278 public ParameterDeclaration getParameter(int i) { 279 return (ParameterDeclaration) getParameterList().getChild(i); 280 } 281 /** 282 * Check whether the Parameter list has any children. 283 * @return {@code true} if it has at least one child, {@code false} otherwise. 284 * @apilevel high-level 285 */ 286 public boolean hasParameter() { 287 return getParameterList().getNumChild() != 0; 288 } 289 /** 290 * Append an element to the Parameter list. 291 * @param node The element to append to the Parameter list. 292 * @apilevel high-level 293 */ 294 public void addParameter(ParameterDeclaration node) { 295 List<ParameterDeclaration> list = (parent == null) ? getParameterListNoTransform() : getParameterList(); 296 list.addChild(node); 297 } 298 /** 299 * @apilevel low-level 300 */ 301 public void addParameterNoTransform(ParameterDeclaration node) { 302 List<ParameterDeclaration> list = getParameterListNoTransform(); 303 list.addChild(node); 304 } 305 /** 306 * Replaces the Parameter list element at index {@code i} with the new node {@code node}. 307 * @param node The new node to replace the old list element. 308 * @param i The list index of the node to be replaced. 309 * @apilevel high-level 310 */ 311 public void setParameter(ParameterDeclaration node, int i) { 312 List<ParameterDeclaration> list = getParameterList(); 313 list.setChild(node, i); 314 } 315 /** 316 * Retrieves the Parameter list. 317 * @return The node representing the Parameter list. 318 * @apilevel high-level 319 */ 320 @ASTNodeAnnotation.ListChild(name="Parameter") 321 public List<ParameterDeclaration> getParameterList() { 322 List<ParameterDeclaration> list = (List<ParameterDeclaration>) getChild(1); 323 return list; 324 } 325 /** 326 * Retrieves the Parameter list. 327 * <p><em>This method does not invoke AST transformations.</em></p> 328 * @return The node representing the Parameter list. 329 * @apilevel low-level 330 */ 331 public List<ParameterDeclaration> getParameterListNoTransform() { 332 return (List<ParameterDeclaration>) getChildNoTransform(1); 333 } 334 /** 335 * Retrieves the Parameter list. 336 * @return The node representing the Parameter list. 337 * @apilevel high-level 338 */ 339 public List<ParameterDeclaration> getParameters() { 340 return getParameterList(); 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 */ 348 public List<ParameterDeclaration> getParametersNoTransform() { 349 return getParameterListNoTransform(); 350 } 351 /** 352 * Replaces the Exception list. 353 * @param list The new list node to be used as the Exception list. 354 * @apilevel high-level 355 */ 356 public void setExceptionList(List<Access> list) { 357 setChild(list, 2); 358 } 359 /** 360 * Retrieves the number of children in the Exception list. 361 * @return Number of children in the Exception list. 362 * @apilevel high-level 363 */ 364 public int getNumException() { 365 return getExceptionList().getNumChild(); 366 } 367 /** 368 * Retrieves the number of children in the Exception list. 369 * Calling this method will not trigger rewrites. 370 * @return Number of children in the Exception list. 371 * @apilevel low-level 372 */ 373 public int getNumExceptionNoTransform() { 374 return getExceptionListNoTransform().getNumChildNoTransform(); 375 } 376 /** 377 * Retrieves the element at index {@code i} in the Exception list. 378 * @param i Index of the element to return. 379 * @return The element at position {@code i} in the Exception list. 380 * @apilevel high-level 381 */ 382 public Access getException(int i) { 383 return (Access) getExceptionList().getChild(i); 384 } 385 /** 386 * Check whether the Exception list has any children. 387 * @return {@code true} if it has at least one child, {@code false} otherwise. 388 * @apilevel high-level 389 */ 390 public boolean hasException() { 391 return getExceptionList().getNumChild() != 0; 392 } 393 /** 394 * Append an element to the Exception list. 395 * @param node The element to append to the Exception list. 396 * @apilevel high-level 397 */ 398 public void addException(Access node) { 399 List<Access> list = (parent == null) ? getExceptionListNoTransform() : getExceptionList(); 400 list.addChild(node); 401 } 402 /** 403 * @apilevel low-level 404 */ 405 public void addExceptionNoTransform(Access node) { 406 List<Access> list = getExceptionListNoTransform(); 407 list.addChild(node); 408 } 409 /** 410 * Replaces the Exception list element at index {@code i} with the new node {@code node}. 411 * @param node The new node to replace the old list element. 412 * @param i The list index of the node to be replaced. 413 * @apilevel high-level 414 */ 415 public void setException(Access node, int i) { 416 List<Access> list = getExceptionList(); 417 list.setChild(node, i); 418 } 419 /** 420 * Retrieves the Exception list. 421 * @return The node representing the Exception list. 422 * @apilevel high-level 423 */ 424 @ASTNodeAnnotation.ListChild(name="Exception") 425 public List<Access> getExceptionList() { 426 List<Access> list = (List<Access>) getChild(2); 427 return list; 428 } 429 /** 430 * Retrieves the Exception list. 431 * <p><em>This method does not invoke AST transformations.</em></p> 432 * @return The node representing the Exception list. 433 * @apilevel low-level 434 */ 435 public List<Access> getExceptionListNoTransform() { 436 return (List<Access>) getChildNoTransform(2); 437 } 438 /** 439 * Retrieves the Exception list. 440 * @return The node representing the Exception list. 441 * @apilevel high-level 442 */ 443 public List<Access> getExceptions() { 444 return getExceptionList(); 445 } 446 /** 447 * Retrieves the Exception list. 448 * <p><em>This method does not invoke AST transformations.</em></p> 449 * @return The node representing the Exception list. 450 * @apilevel low-level 451 */ 452 public List<Access> getExceptionsNoTransform() { 453 return getExceptionListNoTransform(); 454 } 455 /** 456 * Replaces the optional node for the ParsedConstructorInvocation child. This is the <code>Opt</code> 457 * node containing the child ParsedConstructorInvocation, not the actual child! 458 * @param opt The new node to be used as the optional node for the ParsedConstructorInvocation child. 459 * @apilevel low-level 460 */ 461 public void setParsedConstructorInvocationOpt(Opt<Stmt> opt) { 462 setChild(opt, 3); 463 } 464 /** 465 * Replaces the (optional) ParsedConstructorInvocation child. 466 * @param node The new node to be used as the ParsedConstructorInvocation child. 467 * @apilevel high-level 468 */ 469 public void setParsedConstructorInvocation(Stmt node) { 470 getParsedConstructorInvocationOpt().setChild(node, 0); 471 } 472 /** 473 * Check whether the optional ParsedConstructorInvocation child exists. 474 * @return {@code true} if the optional ParsedConstructorInvocation child exists, {@code false} if it does not. 475 * @apilevel high-level 476 */ 477 public boolean hasParsedConstructorInvocation() { 478 return getParsedConstructorInvocationOpt().getNumChild() != 0; 479 } 480 /** 481 * Retrieves the (optional) ParsedConstructorInvocation child. 482 * @return The ParsedConstructorInvocation child, if it exists. Returns {@code null} otherwise. 483 * @apilevel low-level 484 */ 485 public Stmt getParsedConstructorInvocation() { 486 return (Stmt) getParsedConstructorInvocationOpt().getChild(0); 487 } 488 /** 489 * Retrieves the optional node for the ParsedConstructorInvocation child. This is the <code>Opt</code> node containing the child ParsedConstructorInvocation, not the actual child! 490 * @return The optional node for child the ParsedConstructorInvocation child. 491 * @apilevel low-level 492 */ 493 @ASTNodeAnnotation.OptChild(name="ParsedConstructorInvocation") 494 public Opt<Stmt> getParsedConstructorInvocationOpt() { 495 return (Opt<Stmt>) getChild(3); 496 } 497 /** 498 * Retrieves the optional node for child ParsedConstructorInvocation. This is the <code>Opt</code> node containing the child ParsedConstructorInvocation, not the actual child! 499 * <p><em>This method does not invoke AST transformations.</em></p> 500 * @return The optional node for child ParsedConstructorInvocation. 501 * @apilevel low-level 502 */ 503 public Opt<Stmt> getParsedConstructorInvocationOptNoTransform() { 504 return (Opt<Stmt>) getChildNoTransform(3); 505 } 506 /** 507 * Replaces the Block child. 508 * @param node The new node to replace the Block child. 509 * @apilevel high-level 510 */ 511 public void setBlock(Block node) { 512 setChild(node, 4); 513 } 514 /** 515 * Retrieves the Block child. 516 * @return The current node used as the Block child. 517 * @apilevel high-level 518 */ 519 @ASTNodeAnnotation.Child(name="Block") 520 public Block getBlock() { 521 return (Block) getChild(4); 522 } 523 /** 524 * Retrieves the Block child. 525 * <p><em>This method does not invoke AST transformations.</em></p> 526 * @return The current node used as the Block child. 527 * @apilevel low-level 528 */ 529 public Block getBlockNoTransform() { 530 return (Block) getChildNoTransform(4); 531 } 532 /** 533 * Replaces the TypeArgument list. 534 * @param list The new list node to be used as the TypeArgument list. 535 * @apilevel high-level 536 */ 537 public void setTypeArgumentList(List<Access> list) { 538 setChild(list, 5); 539 } 540 /** 541 * Retrieves the number of children in the TypeArgument list. 542 * @return Number of children in the TypeArgument list. 543 * @apilevel high-level 544 */ 545 public int getNumTypeArgument() { 546 return getTypeArgumentList().getNumChild(); 547 } 548 /** 549 * Retrieves the number of children in the TypeArgument list. 550 * Calling this method will not trigger rewrites. 551 * @return Number of children in the TypeArgument list. 552 * @apilevel low-level 553 */ 554 public int getNumTypeArgumentNoTransform() { 555 return getTypeArgumentListNoTransform().getNumChildNoTransform(); 556 } 557 /** 558 * Retrieves the element at index {@code i} in the TypeArgument list. 559 * @param i Index of the element to return. 560 * @return The element at position {@code i} in the TypeArgument list. 561 * @apilevel high-level 562 */ 563 public Access getTypeArgument(int i) { 564 return (Access) getTypeArgumentList().getChild(i); 565 } 566 /** 567 * Check whether the TypeArgument list has any children. 568 * @return {@code true} if it has at least one child, {@code false} otherwise. 569 * @apilevel high-level 570 */ 571 public boolean hasTypeArgument() { 572 return getTypeArgumentList().getNumChild() != 0; 573 } 574 /** 575 * Append an element to the TypeArgument list. 576 * @param node The element to append to the TypeArgument list. 577 * @apilevel high-level 578 */ 579 public void addTypeArgument(Access node) { 580 List<Access> list = (parent == null) ? getTypeArgumentListNoTransform() : getTypeArgumentList(); 581 list.addChild(node); 582 } 583 /** 584 * @apilevel low-level 585 */ 586 public void addTypeArgumentNoTransform(Access node) { 587 List<Access> list = getTypeArgumentListNoTransform(); 588 list.addChild(node); 589 } 590 /** 591 * Replaces the TypeArgument list element at index {@code i} with the new node {@code node}. 592 * @param node The new node to replace the old list element. 593 * @param i The list index of the node to be replaced. 594 * @apilevel high-level 595 */ 596 public void setTypeArgument(Access node, int i) { 597 List<Access> list = getTypeArgumentList(); 598 list.setChild(node, i); 599 } 600 /** 601 * Retrieves the TypeArgument list. 602 * @return The node representing the TypeArgument list. 603 * @apilevel high-level 604 */ 605 @ASTNodeAnnotation.ListChild(name="TypeArgument") 606 public List<Access> getTypeArgumentList() { 607 List<Access> list = (List<Access>) getChild(5); 608 return list; 609 } 610 /** 611 * Retrieves the TypeArgument list. 612 * <p><em>This method does not invoke AST transformations.</em></p> 613 * @return The node representing the TypeArgument list. 614 * @apilevel low-level 615 */ 616 public List<Access> getTypeArgumentListNoTransform() { 617 return (List<Access>) getChildNoTransform(5); 618 } 619 /** 620 * Retrieves the TypeArgument list. 621 * @return The node representing the TypeArgument list. 622 * @apilevel high-level 623 */ 624 public List<Access> getTypeArguments() { 625 return getTypeArgumentList(); 626 } 627 /** 628 * Retrieves the TypeArgument list. 629 * <p><em>This method does not invoke AST transformations.</em></p> 630 * @return The node representing the TypeArgument list. 631 * @apilevel low-level 632 */ 633 public List<Access> getTypeArgumentsNoTransform() { 634 return getTypeArgumentListNoTransform(); 635 } 636 /** 637 * Replaces the lexeme GenericConstructorDecl. 638 * @param value The new value for the lexeme GenericConstructorDecl. 639 * @apilevel high-level 640 */ 641 public void setGenericConstructorDecl(GenericConstructorDecl value) { 642 tokenGenericConstructorDecl_GenericConstructorDecl = value; 643 } 644 /** 645 * Retrieves the value for the lexeme GenericConstructorDecl. 646 * @return The value for the lexeme GenericConstructorDecl. 647 * @apilevel high-level 648 */ 649 @ASTNodeAnnotation.Token(name="GenericConstructorDecl") 650 public GenericConstructorDecl getGenericConstructorDecl() { 651 return tokenGenericConstructorDecl_GenericConstructorDecl; 652 } 653 /** 654 * Retrieves the ImplicitConstructorInvocation child. 655 * <p><em>This method does not invoke AST transformations.</em></p> 656 * @return The current node used as the ImplicitConstructorInvocation child. 657 * @apilevel low-level 658 */ 659 public Stmt getImplicitConstructorInvocationNoTransform() { 660 return (Stmt) getChildNoTransform(6); 661 } 662 /** 663 * Retrieves the child position of the optional child ImplicitConstructorInvocation. 664 * @return The the child position of the optional child ImplicitConstructorInvocation. 665 * @apilevel low-level 666 */ 667 protected int getImplicitConstructorInvocationChildPosition() { 668 return 6; 669 } 670 /** 671 * @apilevel internal 672 */ 673 public ASTNode rewriteTo() { 674 return super.rewriteTo(); 675 } 676 }