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 BooleanType : {@link PrimitiveType}; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:54 017 */ 018 public class BooleanType extends PrimitiveType 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 BooleanType clone() throws CloneNotSupportedException { 034 BooleanType node = (BooleanType)super.clone(); 035 node.typeDescriptor_computed = false; 036 node.typeDescriptor_value = null; 037 node.jvmName_computed = false; 038 node.jvmName_value = null; 039 node.boxed_computed = false; 040 node.boxed_value = null; 041 node.in$Circle(false); 042 node.is$Final(false); 043 return node; 044 } 045 /** 046 * @apilevel internal 047 */ 048 @SuppressWarnings({"unchecked", "cast"}) 049 public BooleanType copy() { 050 051 try { 052 BooleanType node = (BooleanType) clone(); 053 node.parent = null; 054 if(children != null) 055 node.children = (ASTNode[]) children.clone(); 056 057 return node; 058 } catch (CloneNotSupportedException e) { 059 throw new Error("Error: clone not supported for " + getClass().getName()); 060 } 061 062 }/** 063 * Create a deep copy of the AST subtree at this node. 064 * The copy is dangling, i.e. has no parent. 065 * @return dangling copy of the subtree at this node 066 * @apilevel low-level 067 */ 068 @SuppressWarnings({"unchecked", "cast"}) 069 public BooleanType fullCopy() { 070 071 BooleanType tree = (BooleanType) copy(); 072 if (children != null) { 073 for (int i = 0; i < children.length; ++i) { 074 075 ASTNode child = (ASTNode) children[i]; 076 if(child != null) { 077 child = child.fullCopy(); 078 tree.setChild(child, i); 079 } 080 } 081 } 082 return tree; 083 084 } /** 085 * @ast method 086 * @aspect PrettyPrint 087 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:832 088 */ 089 public void toString(StringBuffer s) { 090 s.append("boolean"); 091 } 092 /** 093 * @ast method 094 * @aspect Attributes 095 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Attributes.jrag:62 096 */ 097 public int addConstant(ConstantPool p, Constant c) { return p.addConstant(c.booleanValue() ? 1 : 0); } 098 /** 099 * @ast method 100 * @aspect CodeGenerationBinaryOperations 101 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1048 102 */ 103 void logNot(CodeGeneration gen) { gen.emit(Bytecode.ICONST_1).emit(Bytecode.IXOR); } 104 /** 105 * @ast method 106 * @aspect CodeGenerationBinaryOperations 107 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1095 108 */ 109 void bitand(CodeGeneration gen) {gen.emit(Bytecode.IAND);} 110 /** 111 * @ast method 112 * @aspect CodeGenerationBinaryOperations 113 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1100 114 */ 115 void bitor(CodeGeneration gen) {gen.emit(Bytecode.IOR);} 116 /** 117 * @ast method 118 * @aspect CodeGenerationBinaryOperations 119 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1105 120 */ 121 void bitxor(CodeGeneration gen) {gen.emit(Bytecode.IXOR);} 122 /** 123 * @ast method 124 * @aspect CodeGenerationBranch 125 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1138 126 */ 127 public void branchEQ(CodeGeneration gen, int label) { gen.emitCompare(Bytecode.IF_ICMPEQ, label); } 128 /** 129 * @ast method 130 * @aspect CodeGenerationBranch 131 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1147 132 */ 133 public void branchNE(CodeGeneration gen, int label) { gen.emitCompare(Bytecode.IF_ICMPNE, label); } 134 /** 135 * @ast method 136 * @aspect AnnotationsCodegen 137 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/AnnotationsCodegen.jrag:177 138 */ 139 public int addAnnotConstant(ConstantPool p, Constant c) { 140 return addConstant(p, c); 141 } 142 /** 143 * @ast method 144 * 145 */ 146 public BooleanType() { 147 super(); 148 149 150 } 151 /** 152 * Initializes the child array to the correct size. 153 * Initializes List and Opt nta children. 154 * @apilevel internal 155 * @ast method 156 * @ast method 157 * 158 */ 159 public void init$Children() { 160 children = new ASTNode[3]; 161 setChild(new Opt(), 1); 162 setChild(new List(), 2); 163 } 164 /** 165 * @ast method 166 * 167 */ 168 public BooleanType(Modifiers p0, String p1, Opt<Access> p2, List<BodyDecl> p3) { 169 setChild(p0, 0); 170 setID(p1); 171 setChild(p2, 1); 172 setChild(p3, 2); 173 } 174 /** 175 * @ast method 176 * 177 */ 178 public BooleanType(Modifiers p0, beaver.Symbol p1, Opt<Access> p2, List<BodyDecl> p3) { 179 setChild(p0, 0); 180 setID(p1); 181 setChild(p2, 1); 182 setChild(p3, 2); 183 } 184 /** 185 * @apilevel low-level 186 * @ast method 187 * 188 */ 189 protected int numChildren() { 190 return 3; 191 } 192 /** 193 * @apilevel internal 194 * @ast method 195 * 196 */ 197 public boolean mayHaveRewrite() { 198 return false; 199 } 200 /** 201 * Replaces the Modifiers child. 202 * @param node The new node to replace the Modifiers child. 203 * @apilevel high-level 204 * @ast method 205 * 206 */ 207 public void setModifiers(Modifiers node) { 208 setChild(node, 0); 209 } 210 /** 211 * Retrieves the Modifiers child. 212 * @return The current node used as the Modifiers child. 213 * @apilevel high-level 214 * @ast method 215 * 216 */ 217 public Modifiers getModifiers() { 218 return (Modifiers)getChild(0); 219 } 220 /** 221 * Retrieves the Modifiers child. 222 * <p><em>This method does not invoke AST transformations.</em></p> 223 * @return The current node used as the Modifiers child. 224 * @apilevel low-level 225 * @ast method 226 * 227 */ 228 public Modifiers getModifiersNoTransform() { 229 return (Modifiers)getChildNoTransform(0); 230 } 231 /** 232 * Replaces the lexeme ID. 233 * @param value The new value for the lexeme ID. 234 * @apilevel high-level 235 * @ast method 236 * 237 */ 238 public void setID(String value) { 239 tokenString_ID = value; 240 } 241 /** 242 * JastAdd-internal setter for lexeme ID using the Beaver parser. 243 * @apilevel internal 244 * @ast method 245 * 246 */ 247 public void setID(beaver.Symbol symbol) { 248 if(symbol.value != null && !(symbol.value instanceof String)) 249 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 250 tokenString_ID = (String)symbol.value; 251 IDstart = symbol.getStart(); 252 IDend = symbol.getEnd(); 253 } 254 /** 255 * Retrieves the value for the lexeme ID. 256 * @return The value for the lexeme ID. 257 * @apilevel high-level 258 * @ast method 259 * 260 */ 261 public String getID() { 262 return tokenString_ID != null ? tokenString_ID : ""; 263 } 264 /** 265 * Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 266 * @param opt The new node to be used as the optional node for the SuperClassAccess child. 267 * @apilevel low-level 268 * @ast method 269 * 270 */ 271 public void setSuperClassAccessOpt(Opt<Access> opt) { 272 setChild(opt, 1); 273 } 274 /** 275 * Check whether the optional SuperClassAccess child exists. 276 * @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not. 277 * @apilevel high-level 278 * @ast method 279 * 280 */ 281 public boolean hasSuperClassAccess() { 282 return getSuperClassAccessOpt().getNumChild() != 0; 283 } 284 /** 285 * Retrieves the (optional) SuperClassAccess child. 286 * @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise. 287 * @apilevel low-level 288 * @ast method 289 * 290 */ 291 @SuppressWarnings({"unchecked", "cast"}) 292 public Access getSuperClassAccess() { 293 return (Access)getSuperClassAccessOpt().getChild(0); 294 } 295 /** 296 * Replaces the (optional) SuperClassAccess child. 297 * @param node The new node to be used as the SuperClassAccess child. 298 * @apilevel high-level 299 * @ast method 300 * 301 */ 302 public void setSuperClassAccess(Access node) { 303 getSuperClassAccessOpt().setChild(node, 0); 304 } 305 /** 306 * @apilevel low-level 307 * @ast method 308 * 309 */ 310 @SuppressWarnings({"unchecked", "cast"}) 311 public Opt<Access> getSuperClassAccessOpt() { 312 return (Opt<Access>)getChild(1); 313 } 314 /** 315 * Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 316 * <p><em>This method does not invoke AST transformations.</em></p> 317 * @return The optional node for child SuperClassAccess. 318 * @apilevel low-level 319 * @ast method 320 * 321 */ 322 @SuppressWarnings({"unchecked", "cast"}) 323 public Opt<Access> getSuperClassAccessOptNoTransform() { 324 return (Opt<Access>)getChildNoTransform(1); 325 } 326 /** 327 * Replaces the BodyDecl list. 328 * @param list The new list node to be used as the BodyDecl list. 329 * @apilevel high-level 330 * @ast method 331 * 332 */ 333 public void setBodyDeclList(List<BodyDecl> list) { 334 setChild(list, 2); 335 } 336 /** 337 * Retrieves the number of children in the BodyDecl list. 338 * @return Number of children in the BodyDecl list. 339 * @apilevel high-level 340 * @ast method 341 * 342 */ 343 public int getNumBodyDecl() { 344 return getBodyDeclList().getNumChild(); 345 } 346 /** 347 * Retrieves the number of children in the BodyDecl list. 348 * Calling this method will not trigger rewrites.. 349 * @return Number of children in the BodyDecl list. 350 * @apilevel low-level 351 * @ast method 352 * 353 */ 354 public int getNumBodyDeclNoTransform() { 355 return getBodyDeclListNoTransform().getNumChildNoTransform(); 356 } 357 /** 358 * Retrieves the element at index {@code i} in the BodyDecl list.. 359 * @param i Index of the element to return. 360 * @return The element at position {@code i} in the BodyDecl list. 361 * @apilevel high-level 362 * @ast method 363 * 364 */ 365 @SuppressWarnings({"unchecked", "cast"}) 366 public BodyDecl getBodyDecl(int i) { 367 return (BodyDecl)getBodyDeclList().getChild(i); 368 } 369 /** 370 * Append an element to the BodyDecl list. 371 * @param node The element to append to the BodyDecl list. 372 * @apilevel high-level 373 * @ast method 374 * 375 */ 376 public void addBodyDecl(BodyDecl node) { 377 List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 378 list.addChild(node); 379 } 380 /** 381 * @apilevel low-level 382 * @ast method 383 * 384 */ 385 public void addBodyDeclNoTransform(BodyDecl node) { 386 List<BodyDecl> list = getBodyDeclListNoTransform(); 387 list.addChild(node); 388 } 389 /** 390 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 391 * @param node The new node to replace the old list element. 392 * @param i The list index of the node to be replaced. 393 * @apilevel high-level 394 * @ast method 395 * 396 */ 397 public void setBodyDecl(BodyDecl node, int i) { 398 List<BodyDecl> list = getBodyDeclList(); 399 list.setChild(node, i); 400 } 401 /** 402 * Retrieves the BodyDecl list. 403 * @return The node representing the BodyDecl list. 404 * @apilevel high-level 405 * @ast method 406 * 407 */ 408 public List<BodyDecl> getBodyDecls() { 409 return getBodyDeclList(); 410 } 411 /** 412 * Retrieves the BodyDecl list. 413 * <p><em>This method does not invoke AST transformations.</em></p> 414 * @return The node representing the BodyDecl list. 415 * @apilevel low-level 416 * @ast method 417 * 418 */ 419 public List<BodyDecl> getBodyDeclsNoTransform() { 420 return getBodyDeclListNoTransform(); 421 } 422 /** 423 * Retrieves the BodyDecl list. 424 * @return The node representing the BodyDecl list. 425 * @apilevel high-level 426 * @ast method 427 * 428 */ 429 @SuppressWarnings({"unchecked", "cast"}) 430 public List<BodyDecl> getBodyDeclList() { 431 List<BodyDecl> list = (List<BodyDecl>)getChild(2); 432 list.getNumChild(); 433 return list; 434 } 435 /** 436 * Retrieves the BodyDecl list. 437 * <p><em>This method does not invoke AST transformations.</em></p> 438 * @return The node representing the BodyDecl list. 439 * @apilevel low-level 440 * @ast method 441 * 442 */ 443 @SuppressWarnings({"unchecked", "cast"}) 444 public List<BodyDecl> getBodyDeclListNoTransform() { 445 return (List<BodyDecl>)getChildNoTransform(2); 446 } 447 /** 448 * @ast method 449 * @aspect AutoBoxingCodegen 450 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/AutoBoxingCodegen.jrag:12 451 */ 452 void emitCastTo(CodeGeneration gen, TypeDecl type) { 453 if(type.unboxed() == this || type.isObject()) 454 boxed().emitBoxingOperation(gen); 455 } 456 /** 457 * @attribute syn 458 * @aspect ConstantExpression 459 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:160 460 */ 461 public Constant cast(Constant c) { 462 ASTNode$State state = state(); 463 try { return Constant.create(c.booleanValue()); } 464 finally { 465 } 466 } 467 /** 468 * @attribute syn 469 * @aspect ConstantExpression 470 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:266 471 */ 472 public Constant andBitwise(Constant c1, Constant c2) { 473 ASTNode$State state = state(); 474 try { return Constant.create(c1.booleanValue() & c2.booleanValue()); } 475 finally { 476 } 477 } 478 /** 479 * @attribute syn 480 * @aspect ConstantExpression 481 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:274 482 */ 483 public Constant xorBitwise(Constant c1, Constant c2) { 484 ASTNode$State state = state(); 485 try { return Constant.create(c1.booleanValue() ^ c2.booleanValue()); } 486 finally { 487 } 488 } 489 /** 490 * @attribute syn 491 * @aspect ConstantExpression 492 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:282 493 */ 494 public Constant orBitwise(Constant c1, Constant c2) { 495 ASTNode$State state = state(); 496 try { return Constant.create(c1.booleanValue() | c2.booleanValue()); } 497 finally { 498 } 499 } 500 /** 501 * @attribute syn 502 * @aspect ConstantExpression 503 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:290 504 */ 505 public Constant questionColon(Constant cond, Constant c1, Constant c2) { 506 ASTNode$State state = state(); 507 try { return Constant.create(cond.booleanValue() ? c1.booleanValue() : c2.booleanValue()); } 508 finally { 509 } 510 } 511 /** 512 * @attribute syn 513 * @aspect ConstantExpression 514 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:394 515 */ 516 public boolean eqIsTrue(Expr left, Expr right) { 517 ASTNode$State state = state(); 518 try { return left.isTrue() && right.isTrue() || left.isFalse() && right.isFalse(); } 519 finally { 520 } 521 } 522 /** 523 * @attribute syn 524 * @aspect TypeAnalysis 525 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:181 526 */ 527 public boolean isBoolean() { 528 ASTNode$State state = state(); 529 try { return true; } 530 finally { 531 } 532 } 533 /** 534 * @attribute syn 535 * @aspect CodeGeneration 536 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:621 537 */ 538 public byte arrayLoad() { 539 ASTNode$State state = state(); 540 try { return Bytecode.BALOAD; } 541 finally { 542 } 543 } 544 /** 545 * @attribute syn 546 * @aspect CodeGeneration 547 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:723 548 */ 549 public byte arrayStore() { 550 ASTNode$State state = state(); 551 try { return Bytecode.BASTORE; } 552 finally { 553 } 554 } 555 /** 556 * @apilevel internal 557 */ 558 protected boolean typeDescriptor_computed = false; 559 /** 560 * @apilevel internal 561 */ 562 protected String typeDescriptor_value; 563 /** 564 * @attribute syn 565 * @aspect ConstantPoolNames 566 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/ConstantPoolNames.jrag:17 567 */ 568 @SuppressWarnings({"unchecked", "cast"}) 569 public String typeDescriptor() { 570 if(typeDescriptor_computed) { 571 return typeDescriptor_value; 572 } 573 ASTNode$State state = state(); 574 int num = state.boundariesCrossed; 575 boolean isFinal = this.is$Final(); 576 typeDescriptor_value = typeDescriptor_compute(); 577 if(isFinal && num == state().boundariesCrossed){ typeDescriptor_computed = true; } 578 return typeDescriptor_value; 579 } 580 /** 581 * @apilevel internal 582 */ 583 private String typeDescriptor_compute() { return "Z"; } 584 /** 585 * @attribute syn 586 * @aspect CreateBCode 587 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:825 588 */ 589 public int arrayPrimitiveTypeDescriptor() { 590 ASTNode$State state = state(); 591 try { return 4; } 592 finally { 593 } 594 } 595 /** 596 * @apilevel internal 597 */ 598 protected boolean jvmName_computed = false; 599 /** 600 * @apilevel internal 601 */ 602 protected String jvmName_value; 603 /** 604 * @attribute syn 605 * @aspect Java2Rewrites 606 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Java2Rewrites.jrag:42 607 */ 608 @SuppressWarnings({"unchecked", "cast"}) 609 public String jvmName() { 610 if(jvmName_computed) { 611 return jvmName_value; 612 } 613 ASTNode$State state = state(); 614 int num = state.boundariesCrossed; 615 boolean isFinal = this.is$Final(); 616 jvmName_value = jvmName_compute(); 617 if(isFinal && num == state().boundariesCrossed){ jvmName_computed = true; } 618 return jvmName_value; 619 } 620 /** 621 * @apilevel internal 622 */ 623 private String jvmName_compute() { return "Z"; } 624 /** 625 * @attribute syn 626 * @aspect Java2Rewrites 627 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Java2Rewrites.jrag:44 628 */ 629 public String primitiveClassName() { 630 ASTNode$State state = state(); 631 try { return "Boolean"; } 632 finally { 633 } 634 } 635 /** 636 * @apilevel internal 637 */ 638 protected boolean boxed_computed = false; 639 /** 640 * @apilevel internal 641 */ 642 protected TypeDecl boxed_value; 643 /** 644 * @attribute syn 645 * @aspect AutoBoxing 646 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/AutoBoxing.jrag:36 647 */ 648 @SuppressWarnings({"unchecked", "cast"}) 649 public TypeDecl boxed() { 650 if(boxed_computed) { 651 return boxed_value; 652 } 653 ASTNode$State state = state(); 654 int num = state.boundariesCrossed; 655 boolean isFinal = this.is$Final(); 656 boxed_value = boxed_compute(); 657 if(isFinal && num == state().boundariesCrossed){ boxed_computed = true; } 658 return boxed_value; 659 } 660 /** 661 * @apilevel internal 662 */ 663 private TypeDecl boxed_compute() { return lookupType("java.lang", "Boolean"); } 664 /** 665 * @apilevel internal 666 */ 667 public ASTNode rewriteTo() { 668 return super.rewriteTo(); 669 } 670 }