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