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:18 027 * @production ParSuperConstructorAccess : {@link SuperConstructorAccess} ::= <span class="component">TypeArgument:{@link Access}*</span>; 028 029 */ 030 public class ParSuperConstructorAccess extends SuperConstructorAccess implements Cloneable { 031 /** 032 * @aspect GenericMethodsPrettyPrint 033 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:239 034 */ 035 public void prettyPrint(PrettyPrinter out) { 036 out.print("<"); 037 for (int i = 0; i < getNumTypeArgument(); i++) { 038 if (i != 0) { 039 out.print(", "); 040 } 041 out.print(getTypeArgument(i)); 042 } 043 out.print(">"); 044 super.prettyPrint(out); 045 } 046 /** 047 * @declaredat ASTNode:1 048 */ 049 public ParSuperConstructorAccess() { 050 super(); 051 } 052 /** 053 * Initializes the child array to the correct size. 054 * Initializes List and Opt nta children. 055 * @apilevel internal 056 * @ast method 057 * @declaredat ASTNode:10 058 */ 059 public void init$Children() { 060 children = new ASTNode[2]; 061 setChild(new List(), 0); 062 setChild(new List(), 1); 063 } 064 /** 065 * @declaredat ASTNode:15 066 */ 067 public ParSuperConstructorAccess(String p0, List<Expr> p1, List<Access> p2) { 068 setID(p0); 069 setChild(p1, 0); 070 setChild(p2, 1); 071 } 072 /** 073 * @declaredat ASTNode:20 074 */ 075 public ParSuperConstructorAccess(beaver.Symbol p0, List<Expr> p1, List<Access> p2) { 076 setID(p0); 077 setChild(p1, 0); 078 setChild(p2, 1); 079 } 080 /** 081 * @apilevel low-level 082 * @declaredat ASTNode:28 083 */ 084 protected int numChildren() { 085 return 2; 086 } 087 /** 088 * @apilevel internal 089 * @declaredat ASTNode:34 090 */ 091 public boolean mayHaveRewrite() { 092 return false; 093 } 094 /** 095 * @apilevel internal 096 * @declaredat ASTNode:40 097 */ 098 public void flushAttrCache() { 099 super.flushAttrCache(); 100 } 101 /** 102 * @apilevel internal 103 * @declaredat ASTNode:46 104 */ 105 public void flushCollectionCache() { 106 super.flushCollectionCache(); 107 } 108 /** 109 * @apilevel internal 110 * @declaredat ASTNode:52 111 */ 112 public void flushRewriteCache() { 113 super.flushRewriteCache(); 114 } 115 /** 116 * @apilevel internal 117 * @declaredat ASTNode:58 118 */ 119 public ParSuperConstructorAccess clone() throws CloneNotSupportedException { 120 ParSuperConstructorAccess node = (ParSuperConstructorAccess) super.clone(); 121 return node; 122 } 123 /** 124 * @apilevel internal 125 * @declaredat ASTNode:65 126 */ 127 public ParSuperConstructorAccess copy() { 128 try { 129 ParSuperConstructorAccess node = (ParSuperConstructorAccess) clone(); 130 node.parent = null; 131 if (children != null) { 132 node.children = (ASTNode[]) children.clone(); 133 } 134 return node; 135 } catch (CloneNotSupportedException e) { 136 throw new Error("Error: clone not supported for " + getClass().getName()); 137 } 138 } 139 /** 140 * Create a deep copy of the AST subtree at this node. 141 * The copy is dangling, i.e. has no parent. 142 * @return dangling copy of the subtree at this node 143 * @apilevel low-level 144 * @deprecated Please use treeCopy or treeCopyNoTransform instead 145 * @declaredat ASTNode:84 146 */ 147 @Deprecated 148 public ParSuperConstructorAccess fullCopy() { 149 return treeCopyNoTransform(); 150 } 151 /** 152 * Create a deep copy of the AST subtree at this node. 153 * The copy is dangling, i.e. has no parent. 154 * @return dangling copy of the subtree at this node 155 * @apilevel low-level 156 * @declaredat ASTNode:94 157 */ 158 public ParSuperConstructorAccess treeCopyNoTransform() { 159 ParSuperConstructorAccess tree = (ParSuperConstructorAccess) copy(); 160 if (children != null) { 161 for (int i = 0; i < children.length; ++i) { 162 ASTNode child = (ASTNode) children[i]; 163 if (child != null) { 164 child = child.treeCopyNoTransform(); 165 tree.setChild(child, i); 166 } 167 } 168 } 169 return tree; 170 } 171 /** 172 * Create a deep copy of the AST subtree at this node. 173 * The subtree of this node is traversed to trigger rewrites before copy. 174 * The copy is dangling, i.e. has no parent. 175 * @return dangling copy of the subtree at this node 176 * @apilevel low-level 177 * @declaredat ASTNode:114 178 */ 179 public ParSuperConstructorAccess treeCopy() { 180 doFullTraversal(); 181 return treeCopyNoTransform(); 182 } 183 /** 184 * @apilevel internal 185 * @declaredat ASTNode:121 186 */ 187 protected boolean is$Equal(ASTNode node) { 188 return super.is$Equal(node) && (tokenString_ID == ((ParSuperConstructorAccess)node).tokenString_ID); 189 } 190 /** 191 * Replaces the lexeme ID. 192 * @param value The new value for the lexeme ID. 193 * @apilevel high-level 194 */ 195 public void setID(String value) { 196 tokenString_ID = value; 197 } 198 /** 199 * JastAdd-internal setter for lexeme ID using the Beaver parser. 200 * @param symbol Symbol containing the new value for the lexeme ID 201 * @apilevel internal 202 */ 203 public void setID(beaver.Symbol symbol) { 204 if (symbol.value != null && !(symbol.value instanceof String)) 205 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 206 tokenString_ID = (String)symbol.value; 207 IDstart = symbol.getStart(); 208 IDend = symbol.getEnd(); 209 } 210 /** 211 * Retrieves the value for the lexeme ID. 212 * @return The value for the lexeme ID. 213 * @apilevel high-level 214 */ 215 @ASTNodeAnnotation.Token(name="ID") 216 public String getID() { 217 return tokenString_ID != null ? tokenString_ID : ""; 218 } 219 /** 220 * Replaces the Arg list. 221 * @param list The new list node to be used as the Arg list. 222 * @apilevel high-level 223 */ 224 public void setArgList(List<Expr> list) { 225 setChild(list, 0); 226 } 227 /** 228 * Retrieves the number of children in the Arg list. 229 * @return Number of children in the Arg list. 230 * @apilevel high-level 231 */ 232 public int getNumArg() { 233 return getArgList().getNumChild(); 234 } 235 /** 236 * Retrieves the number of children in the Arg list. 237 * Calling this method will not trigger rewrites. 238 * @return Number of children in the Arg list. 239 * @apilevel low-level 240 */ 241 public int getNumArgNoTransform() { 242 return getArgListNoTransform().getNumChildNoTransform(); 243 } 244 /** 245 * Retrieves the element at index {@code i} in the Arg list. 246 * @param i Index of the element to return. 247 * @return The element at position {@code i} in the Arg list. 248 * @apilevel high-level 249 */ 250 public Expr getArg(int i) { 251 return (Expr) getArgList().getChild(i); 252 } 253 /** 254 * Check whether the Arg list has any children. 255 * @return {@code true} if it has at least one child, {@code false} otherwise. 256 * @apilevel high-level 257 */ 258 public boolean hasArg() { 259 return getArgList().getNumChild() != 0; 260 } 261 /** 262 * Append an element to the Arg list. 263 * @param node The element to append to the Arg list. 264 * @apilevel high-level 265 */ 266 public void addArg(Expr node) { 267 List<Expr> list = (parent == null) ? getArgListNoTransform() : getArgList(); 268 list.addChild(node); 269 } 270 /** 271 * @apilevel low-level 272 */ 273 public void addArgNoTransform(Expr node) { 274 List<Expr> list = getArgListNoTransform(); 275 list.addChild(node); 276 } 277 /** 278 * Replaces the Arg list element at index {@code i} with the new node {@code node}. 279 * @param node The new node to replace the old list element. 280 * @param i The list index of the node to be replaced. 281 * @apilevel high-level 282 */ 283 public void setArg(Expr node, int i) { 284 List<Expr> list = getArgList(); 285 list.setChild(node, i); 286 } 287 /** 288 * Retrieves the Arg list. 289 * @return The node representing the Arg list. 290 * @apilevel high-level 291 */ 292 @ASTNodeAnnotation.ListChild(name="Arg") 293 public List<Expr> getArgList() { 294 List<Expr> list = (List<Expr>) getChild(0); 295 return list; 296 } 297 /** 298 * Retrieves the Arg list. 299 * <p><em>This method does not invoke AST transformations.</em></p> 300 * @return The node representing the Arg list. 301 * @apilevel low-level 302 */ 303 public List<Expr> getArgListNoTransform() { 304 return (List<Expr>) getChildNoTransform(0); 305 } 306 /** 307 * Retrieves the Arg list. 308 * @return The node representing the Arg list. 309 * @apilevel high-level 310 */ 311 public List<Expr> getArgs() { 312 return getArgList(); 313 } 314 /** 315 * Retrieves the Arg list. 316 * <p><em>This method does not invoke AST transformations.</em></p> 317 * @return The node representing the Arg list. 318 * @apilevel low-level 319 */ 320 public List<Expr> getArgsNoTransform() { 321 return getArgListNoTransform(); 322 } 323 /** 324 * Replaces the TypeArgument list. 325 * @param list The new list node to be used as the TypeArgument list. 326 * @apilevel high-level 327 */ 328 public void setTypeArgumentList(List<Access> list) { 329 setChild(list, 1); 330 } 331 /** 332 * Retrieves the number of children in the TypeArgument list. 333 * @return Number of children in the TypeArgument list. 334 * @apilevel high-level 335 */ 336 public int getNumTypeArgument() { 337 return getTypeArgumentList().getNumChild(); 338 } 339 /** 340 * Retrieves the number of children in the TypeArgument list. 341 * Calling this method will not trigger rewrites. 342 * @return Number of children in the TypeArgument list. 343 * @apilevel low-level 344 */ 345 public int getNumTypeArgumentNoTransform() { 346 return getTypeArgumentListNoTransform().getNumChildNoTransform(); 347 } 348 /** 349 * Retrieves the element at index {@code i} in the TypeArgument list. 350 * @param i Index of the element to return. 351 * @return The element at position {@code i} in the TypeArgument list. 352 * @apilevel high-level 353 */ 354 public Access getTypeArgument(int i) { 355 return (Access) getTypeArgumentList().getChild(i); 356 } 357 /** 358 * Check whether the TypeArgument list has any children. 359 * @return {@code true} if it has at least one child, {@code false} otherwise. 360 * @apilevel high-level 361 */ 362 public boolean hasTypeArgument() { 363 return getTypeArgumentList().getNumChild() != 0; 364 } 365 /** 366 * Append an element to the TypeArgument list. 367 * @param node The element to append to the TypeArgument list. 368 * @apilevel high-level 369 */ 370 public void addTypeArgument(Access node) { 371 List<Access> list = (parent == null) ? getTypeArgumentListNoTransform() : getTypeArgumentList(); 372 list.addChild(node); 373 } 374 /** 375 * @apilevel low-level 376 */ 377 public void addTypeArgumentNoTransform(Access node) { 378 List<Access> list = getTypeArgumentListNoTransform(); 379 list.addChild(node); 380 } 381 /** 382 * Replaces the TypeArgument list element at index {@code i} with the new node {@code node}. 383 * @param node The new node to replace the old list element. 384 * @param i The list index of the node to be replaced. 385 * @apilevel high-level 386 */ 387 public void setTypeArgument(Access node, int i) { 388 List<Access> list = getTypeArgumentList(); 389 list.setChild(node, i); 390 } 391 /** 392 * Retrieves the TypeArgument list. 393 * @return The node representing the TypeArgument list. 394 * @apilevel high-level 395 */ 396 @ASTNodeAnnotation.ListChild(name="TypeArgument") 397 public List<Access> getTypeArgumentList() { 398 List<Access> list = (List<Access>) getChild(1); 399 return list; 400 } 401 /** 402 * Retrieves the TypeArgument list. 403 * <p><em>This method does not invoke AST transformations.</em></p> 404 * @return The node representing the TypeArgument list. 405 * @apilevel low-level 406 */ 407 public List<Access> getTypeArgumentListNoTransform() { 408 return (List<Access>) getChildNoTransform(1); 409 } 410 /** 411 * Retrieves the TypeArgument list. 412 * @return The node representing the TypeArgument list. 413 * @apilevel high-level 414 */ 415 public List<Access> getTypeArguments() { 416 return getTypeArgumentList(); 417 } 418 /** 419 * Retrieves the TypeArgument list. 420 * <p><em>This method does not invoke AST transformations.</em></p> 421 * @return The node representing the TypeArgument list. 422 * @apilevel low-level 423 */ 424 public List<Access> getTypeArgumentsNoTransform() { 425 return getTypeArgumentListNoTransform(); 426 } 427 /** 428 * @declaredat /home/jesper/git/extendj/java4/frontend/SyntacticClassification.jrag:36 429 * @apilevel internal 430 */ 431 public NameType Define_nameType(ASTNode caller, ASTNode child) { 432 if (caller == getTypeArgumentListNoTransform()) { 433 // @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:193 434 int childIndex = caller.getIndexOfChild(child); 435 return NameType.TYPE_NAME; 436 } 437 else { 438 return super.Define_nameType(caller, child); 439 } 440 } 441 protected boolean canDefine_nameType(ASTNode caller, ASTNode child) { 442 return true; 443 } 444 /** 445 * @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:197 446 * @apilevel internal 447 */ 448 public SimpleSet Define_lookupType(ASTNode caller, ASTNode child, String name) { 449 if (caller == getTypeArgumentListNoTransform()) { 450 // @declaredat /home/jesper/git/extendj/java5/frontend/GenericMethods.jrag:194 451 int childIndex = caller.getIndexOfChild(child); 452 return unqualifiedScope().lookupType(name); 453 } 454 else { 455 return super.Define_lookupType(caller, child, name); 456 } 457 } 458 protected boolean canDefine_lookupType(ASTNode caller, ASTNode child, String name) { 459 return true; 460 } 461 /** 462 * @apilevel internal 463 */ 464 public ASTNode rewriteTo() { 465 return super.rewriteTo(); 466 } 467 }