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 ParClassInstanceExpr : {@link ClassInstanceExpr} ::= <span class="component">TypeArgument:{@link Access}*</span>; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.ast:18 017 */ 018 public class ParClassInstanceExpr extends ClassInstanceExpr 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 ParClassInstanceExpr clone() throws CloneNotSupportedException { 034 ParClassInstanceExpr node = (ParClassInstanceExpr)super.clone(); 035 node.in$Circle(false); 036 node.is$Final(false); 037 return node; 038 } 039 /** 040 * @apilevel internal 041 */ 042 @SuppressWarnings({"unchecked", "cast"}) 043 public ParClassInstanceExpr copy() { 044 045 try { 046 ParClassInstanceExpr node = (ParClassInstanceExpr) clone(); 047 node.parent = null; 048 if(children != null) 049 node.children = (ASTNode[]) children.clone(); 050 051 return node; 052 } catch (CloneNotSupportedException e) { 053 throw new Error("Error: clone not supported for " + getClass().getName()); 054 } 055 056 }/** 057 * Create a deep copy of the AST subtree at this node. 058 * The copy is dangling, i.e. has no parent. 059 * @return dangling copy of the subtree at this node 060 * @apilevel low-level 061 */ 062 @SuppressWarnings({"unchecked", "cast"}) 063 public ParClassInstanceExpr fullCopy() { 064 065 ParClassInstanceExpr tree = (ParClassInstanceExpr) copy(); 066 if (children != null) { 067 for (int i = 0; i < children.length; ++i) { 068 069 ASTNode child = (ASTNode) children[i]; 070 if(child != null) { 071 child = child.fullCopy(); 072 tree.setChild(child, i); 073 } 074 } 075 } 076 return tree; 077 078 } /** 079 * @ast method 080 * @aspect GenericMethodsPrettyPrint 081 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.jrag:206 082 */ 083 public void toString(StringBuffer s) { 084 s.append("<"); 085 for(int i = 0; i < getNumTypeArgument(); i++) { 086 if(i != 0) s.append(", "); 087 getTypeArgument(i).toString(s); 088 } 089 s.append(">"); 090 super.toString(s); 091 } 092 /** 093 * @ast method 094 * 095 */ 096 public ParClassInstanceExpr() { 097 super(); 098 099 100 } 101 /** 102 * Initializes the child array to the correct size. 103 * Initializes List and Opt nta children. 104 * @apilevel internal 105 * @ast method 106 * @ast method 107 * 108 */ 109 public void init$Children() { 110 children = new ASTNode[4]; 111 setChild(new List(), 1); 112 setChild(new Opt(), 2); 113 setChild(new List(), 3); 114 } 115 /** 116 * @ast method 117 * 118 */ 119 public ParClassInstanceExpr(Access p0, List<Expr> p1, Opt<TypeDecl> p2, List<Access> p3) { 120 setChild(p0, 0); 121 setChild(p1, 1); 122 setChild(p2, 2); 123 setChild(p3, 3); 124 } 125 /** 126 * @apilevel low-level 127 * @ast method 128 * 129 */ 130 protected int numChildren() { 131 return 4; 132 } 133 /** 134 * @apilevel internal 135 * @ast method 136 * 137 */ 138 public boolean mayHaveRewrite() { 139 return false; 140 } 141 /** 142 * Replaces the Access child. 143 * @param node The new node to replace the Access child. 144 * @apilevel high-level 145 * @ast method 146 * 147 */ 148 public void setAccess(Access node) { 149 setChild(node, 0); 150 } 151 /** 152 * Retrieves the Access child. 153 * @return The current node used as the Access child. 154 * @apilevel high-level 155 * @ast method 156 * 157 */ 158 public Access getAccess() { 159 return (Access)getChild(0); 160 } 161 /** 162 * Retrieves the Access child. 163 * <p><em>This method does not invoke AST transformations.</em></p> 164 * @return The current node used as the Access child. 165 * @apilevel low-level 166 * @ast method 167 * 168 */ 169 public Access getAccessNoTransform() { 170 return (Access)getChildNoTransform(0); 171 } 172 /** 173 * Replaces the Arg list. 174 * @param list The new list node to be used as the Arg list. 175 * @apilevel high-level 176 * @ast method 177 * 178 */ 179 public void setArgList(List<Expr> list) { 180 setChild(list, 1); 181 } 182 /** 183 * Retrieves the number of children in the Arg list. 184 * @return Number of children in the Arg list. 185 * @apilevel high-level 186 * @ast method 187 * 188 */ 189 public int getNumArg() { 190 return getArgList().getNumChild(); 191 } 192 /** 193 * Retrieves the number of children in the Arg list. 194 * Calling this method will not trigger rewrites.. 195 * @return Number of children in the Arg list. 196 * @apilevel low-level 197 * @ast method 198 * 199 */ 200 public int getNumArgNoTransform() { 201 return getArgListNoTransform().getNumChildNoTransform(); 202 } 203 /** 204 * Retrieves the element at index {@code i} in the Arg list.. 205 * @param i Index of the element to return. 206 * @return The element at position {@code i} in the Arg list. 207 * @apilevel high-level 208 * @ast method 209 * 210 */ 211 @SuppressWarnings({"unchecked", "cast"}) 212 public Expr getArg(int i) { 213 return (Expr)getArgList().getChild(i); 214 } 215 /** 216 * Append an element to the Arg list. 217 * @param node The element to append to the Arg list. 218 * @apilevel high-level 219 * @ast method 220 * 221 */ 222 public void addArg(Expr node) { 223 List<Expr> list = (parent == null || state == null) ? getArgListNoTransform() : getArgList(); 224 list.addChild(node); 225 } 226 /** 227 * @apilevel low-level 228 * @ast method 229 * 230 */ 231 public void addArgNoTransform(Expr node) { 232 List<Expr> list = getArgListNoTransform(); 233 list.addChild(node); 234 } 235 /** 236 * Replaces the Arg list element at index {@code i} with the new node {@code node}. 237 * @param node The new node to replace the old list element. 238 * @param i The list index of the node to be replaced. 239 * @apilevel high-level 240 * @ast method 241 * 242 */ 243 public void setArg(Expr node, int i) { 244 List<Expr> list = getArgList(); 245 list.setChild(node, i); 246 } 247 /** 248 * Retrieves the Arg list. 249 * @return The node representing the Arg list. 250 * @apilevel high-level 251 * @ast method 252 * 253 */ 254 public List<Expr> getArgs() { 255 return getArgList(); 256 } 257 /** 258 * Retrieves the Arg list. 259 * <p><em>This method does not invoke AST transformations.</em></p> 260 * @return The node representing the Arg list. 261 * @apilevel low-level 262 * @ast method 263 * 264 */ 265 public List<Expr> getArgsNoTransform() { 266 return getArgListNoTransform(); 267 } 268 /** 269 * Retrieves the Arg list. 270 * @return The node representing the Arg list. 271 * @apilevel high-level 272 * @ast method 273 * 274 */ 275 @SuppressWarnings({"unchecked", "cast"}) 276 public List<Expr> getArgList() { 277 List<Expr> list = (List<Expr>)getChild(1); 278 list.getNumChild(); 279 return list; 280 } 281 /** 282 * Retrieves the Arg list. 283 * <p><em>This method does not invoke AST transformations.</em></p> 284 * @return The node representing the Arg list. 285 * @apilevel low-level 286 * @ast method 287 * 288 */ 289 @SuppressWarnings({"unchecked", "cast"}) 290 public List<Expr> getArgListNoTransform() { 291 return (List<Expr>)getChildNoTransform(1); 292 } 293 /** 294 * Replaces the optional node for the TypeDecl child. This is the {@code Opt} node containing the child TypeDecl, not the actual child! 295 * @param opt The new node to be used as the optional node for the TypeDecl child. 296 * @apilevel low-level 297 * @ast method 298 * 299 */ 300 public void setTypeDeclOpt(Opt<TypeDecl> opt) { 301 setChild(opt, 2); 302 } 303 /** 304 * Check whether the optional TypeDecl child exists. 305 * @return {@code true} if the optional TypeDecl child exists, {@code false} if it does not. 306 * @apilevel high-level 307 * @ast method 308 * 309 */ 310 public boolean hasTypeDecl() { 311 return getTypeDeclOpt().getNumChild() != 0; 312 } 313 /** 314 * Retrieves the (optional) TypeDecl child. 315 * @return The TypeDecl child, if it exists. Returns {@code null} otherwise. 316 * @apilevel low-level 317 * @ast method 318 * 319 */ 320 @SuppressWarnings({"unchecked", "cast"}) 321 public TypeDecl getTypeDecl() { 322 return (TypeDecl)getTypeDeclOpt().getChild(0); 323 } 324 /** 325 * Replaces the (optional) TypeDecl child. 326 * @param node The new node to be used as the TypeDecl child. 327 * @apilevel high-level 328 * @ast method 329 * 330 */ 331 public void setTypeDecl(TypeDecl node) { 332 getTypeDeclOpt().setChild(node, 0); 333 } 334 /** 335 * @apilevel low-level 336 * @ast method 337 * 338 */ 339 @SuppressWarnings({"unchecked", "cast"}) 340 public Opt<TypeDecl> getTypeDeclOpt() { 341 return (Opt<TypeDecl>)getChild(2); 342 } 343 /** 344 * Retrieves the optional node for child TypeDecl. This is the {@code Opt} node containing the child TypeDecl, not the actual child! 345 * <p><em>This method does not invoke AST transformations.</em></p> 346 * @return The optional node for child TypeDecl. 347 * @apilevel low-level 348 * @ast method 349 * 350 */ 351 @SuppressWarnings({"unchecked", "cast"}) 352 public Opt<TypeDecl> getTypeDeclOptNoTransform() { 353 return (Opt<TypeDecl>)getChildNoTransform(2); 354 } 355 /** 356 * Replaces the TypeArgument list. 357 * @param list The new list node to be used as the TypeArgument list. 358 * @apilevel high-level 359 * @ast method 360 * 361 */ 362 public void setTypeArgumentList(List<Access> list) { 363 setChild(list, 3); 364 } 365 /** 366 * Retrieves the number of children in the TypeArgument list. 367 * @return Number of children in the TypeArgument list. 368 * @apilevel high-level 369 * @ast method 370 * 371 */ 372 public int getNumTypeArgument() { 373 return getTypeArgumentList().getNumChild(); 374 } 375 /** 376 * Retrieves the number of children in the TypeArgument list. 377 * Calling this method will not trigger rewrites.. 378 * @return Number of children in the TypeArgument list. 379 * @apilevel low-level 380 * @ast method 381 * 382 */ 383 public int getNumTypeArgumentNoTransform() { 384 return getTypeArgumentListNoTransform().getNumChildNoTransform(); 385 } 386 /** 387 * Retrieves the element at index {@code i} in the TypeArgument list.. 388 * @param i Index of the element to return. 389 * @return The element at position {@code i} in the TypeArgument list. 390 * @apilevel high-level 391 * @ast method 392 * 393 */ 394 @SuppressWarnings({"unchecked", "cast"}) 395 public Access getTypeArgument(int i) { 396 return (Access)getTypeArgumentList().getChild(i); 397 } 398 /** 399 * Append an element to the TypeArgument list. 400 * @param node The element to append to the TypeArgument list. 401 * @apilevel high-level 402 * @ast method 403 * 404 */ 405 public void addTypeArgument(Access node) { 406 List<Access> list = (parent == null || state == null) ? getTypeArgumentListNoTransform() : getTypeArgumentList(); 407 list.addChild(node); 408 } 409 /** 410 * @apilevel low-level 411 * @ast method 412 * 413 */ 414 public void addTypeArgumentNoTransform(Access node) { 415 List<Access> list = getTypeArgumentListNoTransform(); 416 list.addChild(node); 417 } 418 /** 419 * Replaces the TypeArgument list element at index {@code i} with the new node {@code node}. 420 * @param node The new node to replace the old list element. 421 * @param i The list index of the node to be replaced. 422 * @apilevel high-level 423 * @ast method 424 * 425 */ 426 public void setTypeArgument(Access node, int i) { 427 List<Access> list = getTypeArgumentList(); 428 list.setChild(node, i); 429 } 430 /** 431 * Retrieves the TypeArgument list. 432 * @return The node representing the TypeArgument list. 433 * @apilevel high-level 434 * @ast method 435 * 436 */ 437 public List<Access> getTypeArguments() { 438 return getTypeArgumentList(); 439 } 440 /** 441 * Retrieves the TypeArgument list. 442 * <p><em>This method does not invoke AST transformations.</em></p> 443 * @return The node representing the TypeArgument list. 444 * @apilevel low-level 445 * @ast method 446 * 447 */ 448 public List<Access> getTypeArgumentsNoTransform() { 449 return getTypeArgumentListNoTransform(); 450 } 451 /** 452 * Retrieves the TypeArgument list. 453 * @return The node representing the TypeArgument list. 454 * @apilevel high-level 455 * @ast method 456 * 457 */ 458 @SuppressWarnings({"unchecked", "cast"}) 459 public List<Access> getTypeArgumentList() { 460 List<Access> list = (List<Access>)getChild(3); 461 list.getNumChild(); 462 return list; 463 } 464 /** 465 * Retrieves the TypeArgument list. 466 * <p><em>This method does not invoke AST transformations.</em></p> 467 * @return The node representing the TypeArgument list. 468 * @apilevel low-level 469 * @ast method 470 * 471 */ 472 @SuppressWarnings({"unchecked", "cast"}) 473 public List<Access> getTypeArgumentListNoTransform() { 474 return (List<Access>)getChildNoTransform(3); 475 } 476 /** 477 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.jrag:172 478 * @apilevel internal 479 */ 480 public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) { 481 if(caller == getTypeArgumentListNoTransform()) { 482 int childIndex = caller.getIndexOfChild(child); 483 return NameType.TYPE_NAME; 484 } 485 else { return super.Define_NameType_nameType(caller, child); 486 } 487 } 488 /** 489 * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.jrag:173 490 * @apilevel internal 491 */ 492 public SimpleSet Define_SimpleSet_lookupType(ASTNode caller, ASTNode child, String name) { 493 if(caller == getTypeArgumentListNoTransform()) { 494 int childIndex = caller.getIndexOfChild(child); 495 return unqualifiedScope().lookupType(name); 496 } 497 else { return super.Define_SimpleSet_lookupType(caller, child, name); 498 } 499 } 500 /** 501 * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/TypeInference.jrag:473 502 * @apilevel internal 503 */ 504 public boolean Define_boolean_isExplicitGenericConstructorAccess(ASTNode caller, ASTNode child) { 505 if(caller == getAccessNoTransform()) { 506 return true; 507 } 508 else { return getParent().Define_boolean_isExplicitGenericConstructorAccess(this, caller); 509 } 510 } 511 /** 512 * @apilevel internal 513 */ 514 public ASTNode rewriteTo() { 515 return super.rewriteTo(); 516 } 517 }