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