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 * @production EmptyType : {@link PrimitiveType}; 015 * @ast node 016 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:46 017 */ 018 public class EmptyType extends PrimitiveType implements Cloneable { 019 /** 020 * @apilevel low-level 021 */ 022 public void flushCache() { 023 } 024 /** 025 * @apilevel internal 026 */ 027 public void flushCollectionCache() { 028 } 029 /** 030 * @apilevel internal 031 */ 032 @SuppressWarnings({"unchecked", "cast"}) 033 public EmptyType clone() throws CloneNotSupportedException { 034 EmptyType node = (EmptyType)super.clone(); 035 node.in$Circle(false); 036 node.is$Final(false); 037 return node; 038 } 039 /** 040 * @apilevel internal 041 */ 042 @SuppressWarnings({"unchecked", "cast"}) 043 public EmptyType copy() { 044 045 try { 046 EmptyType node = (EmptyType) clone(); 047 node.parent = null; 048 if(children != null) 049 node.children = (ASTNode[]) children.clone(); 050 051 return node; 052 } catch (CloneNotSupportedException e) { 053 throw new Error("Error: clone not supported for " + getClass().getName()); 054 } 055 056 }/** 057 * Create a deep copy of the AST subtree at this node. 058 * The copy is dangling, i.e. has no parent. 059 * @return dangling copy of the subtree at this node 060 * @apilevel low-level 061 */ 062 @SuppressWarnings({"unchecked", "cast"}) 063 public EmptyType fullCopy() { 064 065 EmptyType tree = (EmptyType) copy(); 066 if (children != null) { 067 for (int i = 0; i < children.length; ++i) { 068 069 ASTNode child = (ASTNode) children[i]; 070 if(child != null) { 071 child = child.fullCopy(); 072 tree.setChild(child, i); 073 } 074 } 075 } 076 return tree; 077 078 } /** 079 * @ast method 080 * @aspect PrettyPrint 081 * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:216 082 */ 083 public void toString(StringBuffer s) { 084 s.append(indent()); 085 s.append(";"); 086 } 087 /** 088 * @ast method 089 * 090 */ 091 public EmptyType() { 092 super(); 093 094 095 } 096 /** 097 * Initializes the child array to the correct size. 098 * Initializes List and Opt nta children. 099 * @apilevel internal 100 * @ast method 101 * @ast method 102 * 103 */ 104 public void init$Children() { 105 children = new ASTNode[3]; 106 setChild(new Opt(), 1); 107 setChild(new List(), 2); 108 } 109 /** 110 * @ast method 111 * 112 */ 113 public EmptyType(Modifiers p0, String p1, Opt<Access> p2, List<BodyDecl> p3) { 114 setChild(p0, 0); 115 setID(p1); 116 setChild(p2, 1); 117 setChild(p3, 2); 118 } 119 /** 120 * @ast method 121 * 122 */ 123 public EmptyType(Modifiers p0, beaver.Symbol p1, Opt<Access> p2, List<BodyDecl> p3) { 124 setChild(p0, 0); 125 setID(p1); 126 setChild(p2, 1); 127 setChild(p3, 2); 128 } 129 /** 130 * @apilevel low-level 131 * @ast method 132 * 133 */ 134 protected int numChildren() { 135 return 3; 136 } 137 /** 138 * @apilevel internal 139 * @ast method 140 * 141 */ 142 public boolean mayHaveRewrite() { 143 return false; 144 } 145 /** 146 * Replaces the Modifiers child. 147 * @param node The new node to replace the Modifiers child. 148 * @apilevel high-level 149 * @ast method 150 * 151 */ 152 public void setModifiers(Modifiers node) { 153 setChild(node, 0); 154 } 155 /** 156 * Retrieves the Modifiers child. 157 * @return The current node used as the Modifiers child. 158 * @apilevel high-level 159 * @ast method 160 * 161 */ 162 public Modifiers getModifiers() { 163 return (Modifiers)getChild(0); 164 } 165 /** 166 * Retrieves the Modifiers child. 167 * <p><em>This method does not invoke AST transformations.</em></p> 168 * @return The current node used as the Modifiers child. 169 * @apilevel low-level 170 * @ast method 171 * 172 */ 173 public Modifiers getModifiersNoTransform() { 174 return (Modifiers)getChildNoTransform(0); 175 } 176 /** 177 * Replaces the lexeme ID. 178 * @param value The new value for the lexeme ID. 179 * @apilevel high-level 180 * @ast method 181 * 182 */ 183 public void setID(String value) { 184 tokenString_ID = value; 185 } 186 /** 187 * JastAdd-internal setter for lexeme ID using the Beaver parser. 188 * @apilevel internal 189 * @ast method 190 * 191 */ 192 public void setID(beaver.Symbol symbol) { 193 if(symbol.value != null && !(symbol.value instanceof String)) 194 throw new UnsupportedOperationException("setID is only valid for String lexemes"); 195 tokenString_ID = (String)symbol.value; 196 IDstart = symbol.getStart(); 197 IDend = symbol.getEnd(); 198 } 199 /** 200 * Retrieves the value for the lexeme ID. 201 * @return The value for the lexeme ID. 202 * @apilevel high-level 203 * @ast method 204 * 205 */ 206 public String getID() { 207 return tokenString_ID != null ? tokenString_ID : ""; 208 } 209 /** 210 * Replaces the optional node for the SuperClassAccess child. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 211 * @param opt The new node to be used as the optional node for the SuperClassAccess child. 212 * @apilevel low-level 213 * @ast method 214 * 215 */ 216 public void setSuperClassAccessOpt(Opt<Access> opt) { 217 setChild(opt, 1); 218 } 219 /** 220 * Check whether the optional SuperClassAccess child exists. 221 * @return {@code true} if the optional SuperClassAccess child exists, {@code false} if it does not. 222 * @apilevel high-level 223 * @ast method 224 * 225 */ 226 public boolean hasSuperClassAccess() { 227 return getSuperClassAccessOpt().getNumChild() != 0; 228 } 229 /** 230 * Retrieves the (optional) SuperClassAccess child. 231 * @return The SuperClassAccess child, if it exists. Returns {@code null} otherwise. 232 * @apilevel low-level 233 * @ast method 234 * 235 */ 236 @SuppressWarnings({"unchecked", "cast"}) 237 public Access getSuperClassAccess() { 238 return (Access)getSuperClassAccessOpt().getChild(0); 239 } 240 /** 241 * Replaces the (optional) SuperClassAccess child. 242 * @param node The new node to be used as the SuperClassAccess child. 243 * @apilevel high-level 244 * @ast method 245 * 246 */ 247 public void setSuperClassAccess(Access node) { 248 getSuperClassAccessOpt().setChild(node, 0); 249 } 250 /** 251 * @apilevel low-level 252 * @ast method 253 * 254 */ 255 @SuppressWarnings({"unchecked", "cast"}) 256 public Opt<Access> getSuperClassAccessOpt() { 257 return (Opt<Access>)getChild(1); 258 } 259 /** 260 * Retrieves the optional node for child SuperClassAccess. This is the {@code Opt} node containing the child SuperClassAccess, not the actual child! 261 * <p><em>This method does not invoke AST transformations.</em></p> 262 * @return The optional node for child SuperClassAccess. 263 * @apilevel low-level 264 * @ast method 265 * 266 */ 267 @SuppressWarnings({"unchecked", "cast"}) 268 public Opt<Access> getSuperClassAccessOptNoTransform() { 269 return (Opt<Access>)getChildNoTransform(1); 270 } 271 /** 272 * Replaces the BodyDecl list. 273 * @param list The new list node to be used as the BodyDecl list. 274 * @apilevel high-level 275 * @ast method 276 * 277 */ 278 public void setBodyDeclList(List<BodyDecl> list) { 279 setChild(list, 2); 280 } 281 /** 282 * Retrieves the number of children in the BodyDecl list. 283 * @return Number of children in the BodyDecl list. 284 * @apilevel high-level 285 * @ast method 286 * 287 */ 288 public int getNumBodyDecl() { 289 return getBodyDeclList().getNumChild(); 290 } 291 /** 292 * Retrieves the number of children in the BodyDecl list. 293 * Calling this method will not trigger rewrites.. 294 * @return Number of children in the BodyDecl list. 295 * @apilevel low-level 296 * @ast method 297 * 298 */ 299 public int getNumBodyDeclNoTransform() { 300 return getBodyDeclListNoTransform().getNumChildNoTransform(); 301 } 302 /** 303 * Retrieves the element at index {@code i} in the BodyDecl list.. 304 * @param i Index of the element to return. 305 * @return The element at position {@code i} in the BodyDecl list. 306 * @apilevel high-level 307 * @ast method 308 * 309 */ 310 @SuppressWarnings({"unchecked", "cast"}) 311 public BodyDecl getBodyDecl(int i) { 312 return (BodyDecl)getBodyDeclList().getChild(i); 313 } 314 /** 315 * Append an element to the BodyDecl list. 316 * @param node The element to append to the BodyDecl list. 317 * @apilevel high-level 318 * @ast method 319 * 320 */ 321 public void addBodyDecl(BodyDecl node) { 322 List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList(); 323 list.addChild(node); 324 } 325 /** 326 * @apilevel low-level 327 * @ast method 328 * 329 */ 330 public void addBodyDeclNoTransform(BodyDecl node) { 331 List<BodyDecl> list = getBodyDeclListNoTransform(); 332 list.addChild(node); 333 } 334 /** 335 * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}. 336 * @param node The new node to replace the old list element. 337 * @param i The list index of the node to be replaced. 338 * @apilevel high-level 339 * @ast method 340 * 341 */ 342 public void setBodyDecl(BodyDecl node, int i) { 343 List<BodyDecl> list = getBodyDeclList(); 344 list.setChild(node, i); 345 } 346 /** 347 * Retrieves the BodyDecl list. 348 * @return The node representing the BodyDecl list. 349 * @apilevel high-level 350 * @ast method 351 * 352 */ 353 public List<BodyDecl> getBodyDecls() { 354 return getBodyDeclList(); 355 } 356 /** 357 * Retrieves the BodyDecl list. 358 * <p><em>This method does not invoke AST transformations.</em></p> 359 * @return The node representing the BodyDecl list. 360 * @apilevel low-level 361 * @ast method 362 * 363 */ 364 public List<BodyDecl> getBodyDeclsNoTransform() { 365 return getBodyDeclListNoTransform(); 366 } 367 /** 368 * Retrieves the BodyDecl list. 369 * @return The node representing the BodyDecl list. 370 * @apilevel high-level 371 * @ast method 372 * 373 */ 374 @SuppressWarnings({"unchecked", "cast"}) 375 public List<BodyDecl> getBodyDeclList() { 376 List<BodyDecl> list = (List<BodyDecl>)getChild(2); 377 list.getNumChild(); 378 return list; 379 } 380 /** 381 * Retrieves the BodyDecl list. 382 * <p><em>This method does not invoke AST transformations.</em></p> 383 * @return The node representing the BodyDecl list. 384 * @apilevel low-level 385 * @ast method 386 * 387 */ 388 @SuppressWarnings({"unchecked", "cast"}) 389 public List<BodyDecl> getBodyDeclListNoTransform() { 390 return (List<BodyDecl>)getChildNoTransform(2); 391 } 392 /** 393 * @apilevel internal 394 */ 395 public ASTNode rewriteTo() { 396 return super.rewriteTo(); 397 } 398 }