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