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 BoundMethodAccess : {@link MethodAccess}; 016 * @ast node 017 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.ast:3 018 */ 019 public class BoundMethodAccess extends MethodAccess 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 BoundMethodAccess clone() throws CloneNotSupportedException { 035 BoundMethodAccess node = (BoundMethodAccess)super.clone(); 036 node.decl_computed = false; 037 node.decl_value = null; 038 node.in$Circle(false); 039 node.is$Final(false); 040 return node; 041 } 042 /** 043 * @apilevel internal 044 */ 045 @SuppressWarnings({"unchecked", "cast"}) 046 public BoundMethodAccess copy() { 047 048 try { 049 BoundMethodAccess node = (BoundMethodAccess) clone(); 050 node.parent = null; 051 if(children != null) 052 node.children = (ASTNode[]) children.clone(); 053 054 return node; 055 } catch (CloneNotSupportedException e) { 056 throw new Error("Error: clone not supported for " + getClass().getName()); 057 } 058 059 }/** 060 * Create a deep copy of the AST subtree at this node. 061 * The copy is dangling, i.e. has no parent. 062 * @return dangling copy of the subtree at this node 063 * @apilevel low-level 064 */ 065 @SuppressWarnings({"unchecked", "cast"}) 066 public BoundMethodAccess fullCopy() { 067 068 BoundMethodAccess tree = (BoundMethodAccess) copy(); 069 if (children != null) { 070 for (int i = 0; i < children.length; ++i) { 071 072 ASTNode child = (ASTNode) children[i]; 073 if(child != null) { 074 child = child.fullCopy(); 075 tree.setChild(child, i); 076 } 077 } 078 } 079 return tree; 080 081 } /** 082 * @ast method 083 * @aspect BoundNames 084 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.jrag:61 085 */ 086 public BoundMethodAccess(String name, List args, MethodDecl methodDecl) { 087 this(name, args); 088 this.methodDecl = methodDecl; 089 } 090 /** 091 * @ast method 092 * @aspect BoundNames 093 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.jrag:65 094 */ 095 096 private MethodDecl methodDecl; 097 /** 098 * @ast method 099 * 100 */ 101 public BoundMethodAccess() { 102 super(); 103 104 105 } 106 /** 107 * Initializes the child array to the correct size. 108 * Initializes List and Opt nta children. 109 * @apilevel internal 110 * @ast method 111 * @ast method 112 * 113 */ 114 public void init$Children() { 115 children = new ASTNode[1]; 116 setChild(new List(), 0); 117 } 118 /** 119 * @ast method 120 * 121 */ 122 public BoundMethodAccess(String p0, List<Expr> p1) { 123 setID(p0); 124 setChild(p1, 0); 125 } 126 /** 127 * @ast method 128 * 129 */ 130 public BoundMethodAccess(beaver.Symbol p0, List<Expr> p1) { 131 setID(p0); 132 setChild(p1, 0); 133 } 134 /** 135 * @apilevel low-level 136 * @ast method 137 * 138 */ 139 protected int numChildren() { 140 return 1; 141 } 142 /** 143 * @apilevel internal 144 * @ast method 145 * 146 */ 147 public boolean mayHaveRewrite() { 148 return false; 149 } 150 /** 151 * Replaces the lexeme ID. 152 * @param value The new value for the lexeme ID. 153 * @apilevel high-level 154 * @ast method 155 * 156 */ 157 public void setID(String value) { 158 tokenString_ID = value; 159 } 160 /** 161 * JastAdd-internal setter for lexeme ID using the Beaver parser. 162 * @apilevel internal 163 * @ast method 164 * 165 */ 166 public void setID(beaver.Symbol symbol) { 167 if(symbol.value != null && !(symbol.value instanceof String)) 168 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 169 tokenString_ID = (String)symbol.value; 170 IDstart = symbol.getStart(); 171 IDend = symbol.getEnd(); 172 } 173 /** 174 * Retrieves the value for the lexeme ID. 175 * @return The value for the lexeme ID. 176 * @apilevel high-level 177 * @ast method 178 * 179 */ 180 public String getID() { 181 return tokenString_ID != null ? tokenString_ID : ""; 182 } 183 /** 184 * Replaces the Arg list. 185 * @param list The new list node to be used as the Arg list. 186 * @apilevel high-level 187 * @ast method 188 * 189 */ 190 public void setArgList(List<Expr> list) { 191 setChild(list, 0); 192 } 193 /** 194 * Retrieves the number of children in the Arg list. 195 * @return Number of children in the Arg list. 196 * @apilevel high-level 197 * @ast method 198 * 199 */ 200 public int getNumArg() { 201 return getArgList().getNumChild(); 202 } 203 /** 204 * Retrieves the number of children in the Arg list. 205 * Calling this method will not trigger rewrites.. 206 * @return Number of children in the Arg list. 207 * @apilevel low-level 208 * @ast method 209 * 210 */ 211 public int getNumArgNoTransform() { 212 return getArgListNoTransform().getNumChildNoTransform(); 213 } 214 /** 215 * Retrieves the element at index {@code i} in the Arg list.. 216 * @param i Index of the element to return. 217 * @return The element at position {@code i} in the Arg list. 218 * @apilevel high-level 219 * @ast method 220 * 221 */ 222 @SuppressWarnings({"unchecked", "cast"}) 223 public Expr getArg(int i) { 224 return (Expr)getArgList().getChild(i); 225 } 226 /** 227 * Append an element to the Arg list. 228 * @param node The element to append to the Arg list. 229 * @apilevel high-level 230 * @ast method 231 * 232 */ 233 public void addArg(Expr node) { 234 List<Expr> list = (parent == null || state == null) ? getArgListNoTransform() : getArgList(); 235 list.addChild(node); 236 } 237 /** 238 * @apilevel low-level 239 * @ast method 240 * 241 */ 242 public void addArgNoTransform(Expr node) { 243 List<Expr> list = getArgListNoTransform(); 244 list.addChild(node); 245 } 246 /** 247 * Replaces the Arg list element at index {@code i} with the new node {@code node}. 248 * @param node The new node to replace the old list element. 249 * @param i The list index of the node to be replaced. 250 * @apilevel high-level 251 * @ast method 252 * 253 */ 254 public void setArg(Expr node, int i) { 255 List<Expr> list = getArgList(); 256 list.setChild(node, i); 257 } 258 /** 259 * Retrieves the Arg list. 260 * @return The node representing the Arg list. 261 * @apilevel high-level 262 * @ast method 263 * 264 */ 265 public List<Expr> getArgs() { 266 return getArgList(); 267 } 268 /** 269 * Retrieves the Arg list. 270 * <p><em>This method does not invoke AST transformations.</em></p> 271 * @return The node representing the Arg list. 272 * @apilevel low-level 273 * @ast method 274 * 275 */ 276 public List<Expr> getArgsNoTransform() { 277 return getArgListNoTransform(); 278 } 279 /** 280 * Retrieves the Arg list. 281 * @return The node representing the Arg list. 282 * @apilevel high-level 283 * @ast method 284 * 285 */ 286 @SuppressWarnings({"unchecked", "cast"}) 287 public List<Expr> getArgList() { 288 List<Expr> list = (List<Expr>)getChild(0); 289 list.getNumChild(); 290 return list; 291 } 292 /** 293 * Retrieves the Arg list. 294 * <p><em>This method does not invoke AST transformations.</em></p> 295 * @return The node representing the Arg list. 296 * @apilevel low-level 297 * @ast method 298 * 299 */ 300 @SuppressWarnings({"unchecked", "cast"}) 301 public List<Expr> getArgListNoTransform() { 302 return (List<Expr>)getChildNoTransform(0); 303 } 304 /** 305 * @apilevel internal 306 */ 307 protected boolean decl_computed = false; 308 /** 309 * @apilevel internal 310 */ 311 protected MethodDecl decl_value; 312 /** 313 * @attribute syn 314 * @aspect BoundNames 315 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/BoundNames.jrag:66 316 */ 317 @SuppressWarnings({"unchecked", "cast"}) 318 public MethodDecl decl() { 319 if(decl_computed) { 320 return decl_value; 321 } 322 ASTNode$State state = state(); 323 int num = state.boundariesCrossed; 324 boolean isFinal = this.is$Final(); 325 decl_value = decl_compute(); 326 if(isFinal && num == state().boundariesCrossed){ decl_computed = true; } 327 return decl_value; 328 } 329 /** 330 * @apilevel internal 331 */ 332 private MethodDecl decl_compute() { return methodDecl; } 333 /** 334 * @apilevel internal 335 */ 336 public ASTNode rewriteTo() { 337 return super.rewriteTo(); 338 } 339 }