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/VariableArityParameters.ast:1 027 * @production VariableArityParameterDeclaration : {@link ParameterDeclaration}; 028 029 */ 030 public class VariableArityParameterDeclaration extends ParameterDeclaration implements Cloneable { 031 /** 032 * @aspect Java5PrettyPrint 033 * @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:379 034 */ 035 public void prettyPrint(PrettyPrinter out) { 036 out.print(getModifiers()); 037 out.print(getTypeAccess()); 038 out.print("... "); 039 out.print(getID()); 040 } 041 /** 042 * @aspect VariableArityParameters 043 * @declaredat /home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:36 044 */ 045 public void nameCheck() { 046 super.nameCheck(); 047 if (!variableArityValid()) { 048 error("only the last formal paramater may be of variable arity"); 049 } 050 } 051 /** 052 * @declaredat ASTNode:1 053 */ 054 public VariableArityParameterDeclaration() { 055 super(); 056 } 057 /** 058 * Initializes the child array to the correct size. 059 * Initializes List and Opt nta children. 060 * @apilevel internal 061 * @ast method 062 * @declaredat ASTNode:10 063 */ 064 public void init$Children() { 065 children = new ASTNode[2]; 066 } 067 /** 068 * @declaredat ASTNode:13 069 */ 070 public VariableArityParameterDeclaration(Modifiers p0, Access p1, String p2) { 071 setChild(p0, 0); 072 setChild(p1, 1); 073 setID(p2); 074 } 075 /** 076 * @declaredat ASTNode:18 077 */ 078 public VariableArityParameterDeclaration(Modifiers p0, Access p1, beaver.Symbol p2) { 079 setChild(p0, 0); 080 setChild(p1, 1); 081 setID(p2); 082 } 083 /** 084 * @apilevel low-level 085 * @declaredat ASTNode:26 086 */ 087 protected int numChildren() { 088 return 2; 089 } 090 /** 091 * @apilevel internal 092 * @declaredat ASTNode:32 093 */ 094 public boolean mayHaveRewrite() { 095 return false; 096 } 097 /** 098 * @apilevel internal 099 * @declaredat ASTNode:38 100 */ 101 public void flushAttrCache() { 102 super.flushAttrCache(); 103 type_reset(); 104 } 105 /** 106 * @apilevel internal 107 * @declaredat ASTNode:45 108 */ 109 public void flushCollectionCache() { 110 super.flushCollectionCache(); 111 } 112 /** 113 * @apilevel internal 114 * @declaredat ASTNode:51 115 */ 116 public void flushRewriteCache() { 117 super.flushRewriteCache(); 118 } 119 /** 120 * @apilevel internal 121 * @declaredat ASTNode:57 122 */ 123 public VariableArityParameterDeclaration clone() throws CloneNotSupportedException { 124 VariableArityParameterDeclaration node = (VariableArityParameterDeclaration) super.clone(); 125 return node; 126 } 127 /** 128 * @apilevel internal 129 * @declaredat ASTNode:64 130 */ 131 public VariableArityParameterDeclaration copy() { 132 try { 133 VariableArityParameterDeclaration node = (VariableArityParameterDeclaration) clone(); 134 node.parent = null; 135 if (children != null) { 136 node.children = (ASTNode[]) children.clone(); 137 } 138 return node; 139 } catch (CloneNotSupportedException e) { 140 throw new Error("Error: clone not supported for " + getClass().getName()); 141 } 142 } 143 /** 144 * Create a deep copy of the AST subtree at this node. 145 * The copy is dangling, i.e. has no parent. 146 * @return dangling copy of the subtree at this node 147 * @apilevel low-level 148 * @deprecated Please use treeCopy or treeCopyNoTransform instead 149 * @declaredat ASTNode:83 150 */ 151 @Deprecated 152 public VariableArityParameterDeclaration fullCopy() { 153 return treeCopyNoTransform(); 154 } 155 /** 156 * Create a deep copy of the AST subtree at this node. 157 * The copy is dangling, i.e. has no parent. 158 * @return dangling copy of the subtree at this node 159 * @apilevel low-level 160 * @declaredat ASTNode:93 161 */ 162 public VariableArityParameterDeclaration treeCopyNoTransform() { 163 VariableArityParameterDeclaration tree = (VariableArityParameterDeclaration) copy(); 164 if (children != null) { 165 for (int i = 0; i < children.length; ++i) { 166 ASTNode child = (ASTNode) children[i]; 167 if (child != null) { 168 child = child.treeCopyNoTransform(); 169 tree.setChild(child, i); 170 } 171 } 172 } 173 return tree; 174 } 175 /** 176 * Create a deep copy of the AST subtree at this node. 177 * The subtree of this node is traversed to trigger rewrites before copy. 178 * The copy is dangling, i.e. has no parent. 179 * @return dangling copy of the subtree at this node 180 * @apilevel low-level 181 * @declaredat ASTNode:113 182 */ 183 public VariableArityParameterDeclaration treeCopy() { 184 doFullTraversal(); 185 return treeCopyNoTransform(); 186 } 187 /** 188 * @apilevel internal 189 * @declaredat ASTNode:120 190 */ 191 protected boolean is$Equal(ASTNode node) { 192 return super.is$Equal(node) && (tokenString_ID == ((VariableArityParameterDeclaration)node).tokenString_ID); 193 } 194 /** 195 * Replaces the Modifiers child. 196 * @param node The new node to replace the Modifiers child. 197 * @apilevel high-level 198 */ 199 public void setModifiers(Modifiers node) { 200 setChild(node, 0); 201 } 202 /** 203 * Retrieves the Modifiers child. 204 * @return The current node used as the Modifiers child. 205 * @apilevel high-level 206 */ 207 @ASTNodeAnnotation.Child(name="Modifiers") 208 public Modifiers getModifiers() { 209 return (Modifiers) getChild(0); 210 } 211 /** 212 * Retrieves the Modifiers child. 213 * <p><em>This method does not invoke AST transformations.</em></p> 214 * @return The current node used as the Modifiers child. 215 * @apilevel low-level 216 */ 217 public Modifiers getModifiersNoTransform() { 218 return (Modifiers) getChildNoTransform(0); 219 } 220 /** 221 * Replaces the TypeAccess child. 222 * @param node The new node to replace the TypeAccess child. 223 * @apilevel high-level 224 */ 225 public void setTypeAccess(Access node) { 226 setChild(node, 1); 227 } 228 /** 229 * Retrieves the TypeAccess child. 230 * @return The current node used as the TypeAccess child. 231 * @apilevel high-level 232 */ 233 @ASTNodeAnnotation.Child(name="TypeAccess") 234 public Access getTypeAccess() { 235 return (Access) getChild(1); 236 } 237 /** 238 * Retrieves the TypeAccess child. 239 * <p><em>This method does not invoke AST transformations.</em></p> 240 * @return The current node used as the TypeAccess child. 241 * @apilevel low-level 242 */ 243 public Access getTypeAccessNoTransform() { 244 return (Access) getChildNoTransform(1); 245 } 246 /** 247 * Replaces the lexeme ID. 248 * @param value The new value for the lexeme ID. 249 * @apilevel high-level 250 */ 251 public void setID(String value) { 252 tokenString_ID = value; 253 } 254 /** 255 * JastAdd-internal setter for lexeme ID using the Beaver parser. 256 * @param symbol Symbol containing the new value for the lexeme ID 257 * @apilevel internal 258 */ 259 public void setID(beaver.Symbol symbol) { 260 if (symbol.value != null && !(symbol.value instanceof String)) 261 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 262 tokenString_ID = (String)symbol.value; 263 IDstart = symbol.getStart(); 264 IDend = symbol.getEnd(); 265 } 266 /** 267 * Retrieves the value for the lexeme ID. 268 * @return The value for the lexeme ID. 269 * @apilevel high-level 270 */ 271 @ASTNodeAnnotation.Token(name="ID") 272 public String getID() { 273 return tokenString_ID != null ? tokenString_ID : ""; 274 } 275 /** 276 * @apilevel internal 277 */ 278 protected boolean type_computed = false; 279 /** 280 * @apilevel internal 281 */ 282 protected TypeDecl type_value; 283 /** 284 * @apilevel internal 285 */ 286 private void type_reset() { 287 type_computed = false; 288 type_value = null; 289 } 290 /** 291 * @attribute syn 292 * @aspect TypeAnalysis 293 * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:277 294 */ 295 @ASTNodeAnnotation.Attribute 296 public TypeDecl type() { 297 ASTNode$State state = state(); 298 if (type_computed) { 299 return type_value; 300 } 301 boolean intermediate = state.INTERMEDIATE_VALUE; 302 state.INTERMEDIATE_VALUE = false; 303 int num = state.boundariesCrossed; 304 boolean isFinal = this.is$Final(); 305 type_value = super.type().arrayType(); 306 if (isFinal && num == state().boundariesCrossed) { 307 type_computed = true; 308 } else { 309 } 310 state.INTERMEDIATE_VALUE |= intermediate; 311 312 return type_value; 313 } 314 /** 315 * @attribute syn 316 * @aspect VariableArityParameters 317 * @declaredat /home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:57 318 */ 319 @ASTNodeAnnotation.Attribute 320 public boolean isVariableArity() { 321 boolean isVariableArity_value = true; 322 323 return isVariableArity_value; 324 } 325 /** 326 * @attribute inh 327 * @aspect VariableArityParameters 328 * @declaredat /home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:48 329 */ 330 /** 331 * @attribute inh 332 * @aspect VariableArityParameters 333 * @declaredat /home/jesper/git/extendj/java5/frontend/VariableArityParameters.jrag:48 334 */ 335 @ASTNodeAnnotation.Attribute 336 public boolean variableArityValid() { 337 boolean variableArityValid_value = getParent().Define_variableArityValid(this, null); 338 339 return variableArityValid_value; 340 } 341 /** 342 * @apilevel internal 343 */ 344 public ASTNode rewriteTo() { 345 return super.rewriteTo(); 346 } 347 }