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