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/java4/grammar/Java.ast:23 027 * @production PrimitiveTypeAccess : {@link TypeAccess} ::= <span class="component"><Package:String></span> <span class="component"><ID:String></span> <span class="component"><Name:String></span>; 028 029 */ 030 public class PrimitiveTypeAccess extends TypeAccess implements Cloneable { 031 /** 032 * @declaredat ASTNode:1 033 */ 034 public PrimitiveTypeAccess() { 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 } 046 /** 047 * @declaredat ASTNode:12 048 */ 049 public PrimitiveTypeAccess(String p0) { 050 setName(p0); 051 } 052 /** 053 * @declaredat ASTNode:15 054 */ 055 public PrimitiveTypeAccess(beaver.Symbol p0) { 056 setName(p0); 057 } 058 /** 059 * @apilevel low-level 060 * @declaredat ASTNode:21 061 */ 062 protected int numChildren() { 063 return 0; 064 } 065 /** 066 * @apilevel internal 067 * @declaredat ASTNode:27 068 */ 069 public boolean mayHaveRewrite() { 070 return false; 071 } 072 /** 073 * @apilevel internal 074 * @declaredat ASTNode:33 075 */ 076 public void flushAttrCache() { 077 super.flushAttrCache(); 078 decls_reset(); 079 getPackage_reset(); 080 getID_reset(); 081 } 082 /** 083 * @apilevel internal 084 * @declaredat ASTNode:42 085 */ 086 public void flushCollectionCache() { 087 super.flushCollectionCache(); 088 } 089 /** 090 * @apilevel internal 091 * @declaredat ASTNode:48 092 */ 093 public void flushRewriteCache() { 094 super.flushRewriteCache(); 095 } 096 /** 097 * @apilevel internal 098 * @declaredat ASTNode:54 099 */ 100 public PrimitiveTypeAccess clone() throws CloneNotSupportedException { 101 PrimitiveTypeAccess node = (PrimitiveTypeAccess) super.clone(); 102 return node; 103 } 104 /** 105 * @apilevel internal 106 * @declaredat ASTNode:61 107 */ 108 public PrimitiveTypeAccess copy() { 109 try { 110 PrimitiveTypeAccess node = (PrimitiveTypeAccess) clone(); 111 node.parent = null; 112 if (children != null) { 113 node.children = (ASTNode[]) children.clone(); 114 } 115 return node; 116 } catch (CloneNotSupportedException e) { 117 throw new Error("Error: clone not supported for " + getClass().getName()); 118 } 119 } 120 /** 121 * Create a deep copy of the AST subtree at this node. 122 * The copy is dangling, i.e. has no parent. 123 * @return dangling copy of the subtree at this node 124 * @apilevel low-level 125 * @deprecated Please use treeCopy or treeCopyNoTransform instead 126 * @declaredat ASTNode:80 127 */ 128 @Deprecated 129 public PrimitiveTypeAccess fullCopy() { 130 return treeCopyNoTransform(); 131 } 132 /** 133 * Create a deep copy of the AST subtree at this node. 134 * The copy is dangling, i.e. has no parent. 135 * @return dangling copy of the subtree at this node 136 * @apilevel low-level 137 * @declaredat ASTNode:90 138 */ 139 public PrimitiveTypeAccess treeCopyNoTransform() { 140 PrimitiveTypeAccess tree = (PrimitiveTypeAccess) copy(); 141 if (children != null) { 142 for (int i = 0; i < children.length; ++i) { 143 ASTNode child = (ASTNode) children[i]; 144 if (child != null) { 145 child = child.treeCopyNoTransform(); 146 tree.setChild(child, i); 147 } 148 } 149 } 150 return tree; 151 } 152 /** 153 * Create a deep copy of the AST subtree at this node. 154 * The subtree of this node is traversed to trigger rewrites before copy. 155 * The copy is dangling, i.e. has no parent. 156 * @return dangling copy of the subtree at this node 157 * @apilevel low-level 158 * @declaredat ASTNode:110 159 */ 160 public PrimitiveTypeAccess treeCopy() { 161 doFullTraversal(); 162 return treeCopyNoTransform(); 163 } 164 /** 165 * @apilevel internal 166 * @declaredat ASTNode:117 167 */ 168 protected boolean is$Equal(ASTNode node) { 169 return super.is$Equal(node) && (tokenString_Name == ((PrimitiveTypeAccess)node).tokenString_Name); 170 } 171 /** 172 * Replaces the lexeme Name. 173 * @param value The new value for the lexeme Name. 174 * @apilevel high-level 175 */ 176 public void setName(String value) { 177 tokenString_Name = value; 178 } 179 /** 180 * @apilevel internal 181 */ 182 protected String tokenString_Name; 183 /** 184 */ 185 public int Namestart; 186 /** 187 */ 188 public int Nameend; 189 /** 190 * JastAdd-internal setter for lexeme Name using the Beaver parser. 191 * @param symbol Symbol containing the new value for the lexeme Name 192 * @apilevel internal 193 */ 194 public void setName(beaver.Symbol symbol) { 195 if (symbol.value != null && !(symbol.value instanceof String)) 196 throw new UnsupportedOperationException("setName is only valid for String lexemes"); 197 tokenString_Name = (String)symbol.value; 198 Namestart = symbol.getStart(); 199 Nameend = symbol.getEnd(); 200 } 201 /** 202 * Retrieves the value for the lexeme Name. 203 * @return The value for the lexeme Name. 204 * @apilevel high-level 205 */ 206 @ASTNodeAnnotation.Token(name="Name") 207 public String getName() { 208 return tokenString_Name != null ? tokenString_Name : ""; 209 } 210 /** 211 * This method should not be called. This method throws an exception due to 212 * the corresponding child being an NTA shadowing a non-NTA child. 213 * @param node 214 * @apilevel internal 215 */ 216 public void setPackage(String node) { 217 throw new Error("Can not replace NTA child Package in PrimitiveTypeAccess!"); 218 } 219 /** 220 * @apilevel internal 221 */ 222 protected String tokenString_Package; 223 /** 224 * This method should not be called. This method throws an exception due to 225 * the corresponding child being an NTA shadowing a non-NTA child. 226 * @param node 227 * @apilevel internal 228 */ 229 public void setID(String node) { 230 throw new Error("Can not replace NTA child ID in PrimitiveTypeAccess!"); 231 } 232 /** 233 * @apilevel internal 234 */ 235 protected String tokenString_ID; 236 /** 237 * @apilevel internal 238 */ 239 protected boolean decls_computed = false; 240 /** 241 * @apilevel internal 242 */ 243 protected SimpleSet decls_value; 244 /** 245 * @apilevel internal 246 */ 247 private void decls_reset() { 248 decls_computed = false; 249 decls_value = null; 250 } 251 /** 252 * @attribute syn 253 * @aspect TypeScopePropagation 254 * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:303 255 */ 256 @ASTNodeAnnotation.Attribute 257 public SimpleSet decls() { 258 ASTNode$State state = state(); 259 if (decls_computed) { 260 return decls_value; 261 } 262 boolean intermediate = state.INTERMEDIATE_VALUE; 263 state.INTERMEDIATE_VALUE = false; 264 int num = state.boundariesCrossed; 265 boolean isFinal = this.is$Final(); 266 decls_value = lookupType(PRIMITIVE_PACKAGE_NAME, name()); 267 if (isFinal && num == state().boundariesCrossed) { 268 decls_computed = true; 269 } else { 270 } 271 state.INTERMEDIATE_VALUE |= intermediate; 272 273 return decls_value; 274 } 275 /** 276 * @apilevel internal 277 */ 278 protected boolean getPackage_computed = false; 279 /** 280 * @apilevel internal 281 */ 282 protected String getPackage_value; 283 /** 284 * @apilevel internal 285 */ 286 private void getPackage_reset() { 287 getPackage_computed = false; 288 getPackage_value = null; 289 } 290 /** 291 * @attribute syn nta 292 * @aspect TypeScopePropagation 293 * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:304 294 */ 295 @ASTNodeAnnotation.Attribute 296 public String getPackage() { 297 ASTNode$State state = state(); 298 if (getPackage_computed) { 299 return getPackage_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 getPackage_value = PRIMITIVE_PACKAGE_NAME; 306 if (isFinal && num == state().boundariesCrossed) { 307 getPackage_computed = true; 308 } else { 309 } 310 state.INTERMEDIATE_VALUE |= intermediate; 311 312 return getPackage_value; 313 } 314 /** 315 * @apilevel internal 316 */ 317 protected boolean getID_computed = false; 318 /** 319 * @apilevel internal 320 */ 321 protected String getID_value; 322 /** 323 * @apilevel internal 324 */ 325 private void getID_reset() { 326 getID_computed = false; 327 getID_value = null; 328 } 329 /** 330 * @attribute syn nta 331 * @aspect TypeScopePropagation 332 * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:305 333 */ 334 @ASTNodeAnnotation.Attribute 335 public String getID() { 336 ASTNode$State state = state(); 337 if (getID_computed) { 338 return getID_value; 339 } 340 boolean intermediate = state.INTERMEDIATE_VALUE; 341 state.INTERMEDIATE_VALUE = false; 342 int num = state.boundariesCrossed; 343 boolean isFinal = this.is$Final(); 344 getID_value = getName(); 345 if (isFinal && num == state().boundariesCrossed) { 346 getID_computed = true; 347 } else { 348 } 349 state.INTERMEDIATE_VALUE |= intermediate; 350 351 return getID_value; 352 } 353 /** 354 * @apilevel internal 355 */ 356 public ASTNode rewriteTo() { 357 return super.rewriteTo(); 358 } 359 }