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:25
027     * @production AbstractWildcardType : {@link TypeDecl};
028    
029     */
030    public abstract class AbstractWildcardType extends TypeDecl implements Cloneable {
031      /**
032       * Qualified access for wildcard types.
033       * Since they have no ordinary package and type name
034       * we just return the bound access.
035       * @aspect Generics
036       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:39
037       */
038      public Access createQualifiedAccess() {
039        return createBoundAccess();
040      }
041      /**
042       * @declaredat ASTNode:1
043       */
044      public AbstractWildcardType() {
045        super();
046      }
047      /**
048       * Initializes the child array to the correct size.
049       * Initializes List and Opt nta children.
050       * @apilevel internal
051       * @ast method
052       * @declaredat ASTNode:10
053       */
054      public void init$Children() {
055        children = new ASTNode[2];
056        setChild(new List(), 1);
057      }
058      /**
059       * @declaredat ASTNode:14
060       */
061      public AbstractWildcardType(Modifiers p0, String p1, List<BodyDecl> p2) {
062        setChild(p0, 0);
063        setID(p1);
064        setChild(p2, 1);
065      }
066      /**
067       * @declaredat ASTNode:19
068       */
069      public AbstractWildcardType(Modifiers p0, beaver.Symbol p1, List<BodyDecl> p2) {
070        setChild(p0, 0);
071        setID(p1);
072        setChild(p2, 1);
073      }
074      /**
075       * @apilevel low-level
076       * @declaredat ASTNode:27
077       */
078      protected int numChildren() {
079        return 2;
080      }
081      /**
082       * @apilevel internal
083       * @declaredat ASTNode:33
084       */
085      public boolean mayHaveRewrite() {
086        return false;
087      }
088      /**
089       * @apilevel internal
090       * @declaredat ASTNode:39
091       */
092      public void flushAttrCache() {
093        super.flushAttrCache();
094        needsSignatureAttribute_reset();
095      }
096      /**
097       * @apilevel internal
098       * @declaredat ASTNode:46
099       */
100      public void flushCollectionCache() {
101        super.flushCollectionCache();
102      }
103      /**
104       * @apilevel internal
105       * @declaredat ASTNode:52
106       */
107      public void flushRewriteCache() {
108        super.flushRewriteCache();
109      }
110      /**
111       * @apilevel internal
112       * @declaredat ASTNode:58
113       */
114      public AbstractWildcardType clone() throws CloneNotSupportedException {
115        AbstractWildcardType node = (AbstractWildcardType) super.clone();
116        return node;
117      }
118      /**
119       * Create a deep copy of the AST subtree at this node.
120       * The copy is dangling, i.e. has no parent.
121       * @return dangling copy of the subtree at this node
122       * @apilevel low-level
123       * @deprecated Please use treeCopy or treeCopyNoTransform instead
124       * @declaredat ASTNode:69
125       */
126      @Deprecated
127      public abstract AbstractWildcardType fullCopy();
128      /**
129       * Create a deep copy of the AST subtree at this node.
130       * The copy is dangling, i.e. has no parent.
131       * @return dangling copy of the subtree at this node
132       * @apilevel low-level
133       * @declaredat ASTNode:77
134       */
135      public abstract AbstractWildcardType treeCopyNoTransform();
136      /**
137       * Create a deep copy of the AST subtree at this node.
138       * The subtree of this node is traversed to trigger rewrites before copy.
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:85
143       */
144      public abstract AbstractWildcardType treeCopy();
145      /**
146       * Replaces the Modifiers child.
147       * @param node The new node to replace the Modifiers child.
148       * @apilevel high-level
149       */
150      public void setModifiers(Modifiers node) {
151        setChild(node, 0);
152      }
153      /**
154       * Retrieves the Modifiers child.
155       * @return The current node used as the Modifiers child.
156       * @apilevel high-level
157       */
158      @ASTNodeAnnotation.Child(name="Modifiers")
159      public Modifiers getModifiers() {
160        return (Modifiers) getChild(0);
161      }
162      /**
163       * Retrieves the Modifiers child.
164       * <p><em>This method does not invoke AST transformations.</em></p>
165       * @return The current node used as the Modifiers child.
166       * @apilevel low-level
167       */
168      public Modifiers getModifiersNoTransform() {
169        return (Modifiers) getChildNoTransform(0);
170      }
171      /**
172       * Replaces the lexeme ID.
173       * @param value The new value for the lexeme ID.
174       * @apilevel high-level
175       */
176      public void setID(String value) {
177        tokenString_ID = value;
178      }
179      /**
180       * JastAdd-internal setter for lexeme ID using the Beaver parser.
181       * @param symbol Symbol containing the new value for the lexeme ID
182       * @apilevel internal
183       */
184      public void setID(beaver.Symbol symbol) {
185        if (symbol.value != null && !(symbol.value instanceof String))
186        throw new UnsupportedOperationException("setID is only valid for String lexemes");
187        tokenString_ID = (String)symbol.value;
188        IDstart = symbol.getStart();
189        IDend = symbol.getEnd();
190      }
191      /**
192       * Retrieves the value for the lexeme ID.
193       * @return The value for the lexeme ID.
194       * @apilevel high-level
195       */
196      @ASTNodeAnnotation.Token(name="ID")
197      public String getID() {
198        return tokenString_ID != null ? tokenString_ID : "";
199      }
200      /**
201       * Replaces the BodyDecl list.
202       * @param list The new list node to be used as the BodyDecl list.
203       * @apilevel high-level
204       */
205      public void setBodyDeclList(List<BodyDecl> list) {
206        setChild(list, 1);
207      }
208      /**
209       * Retrieves the number of children in the BodyDecl list.
210       * @return Number of children in the BodyDecl list.
211       * @apilevel high-level
212       */
213      public int getNumBodyDecl() {
214        return getBodyDeclList().getNumChild();
215      }
216      /**
217       * Retrieves the number of children in the BodyDecl list.
218       * Calling this method will not trigger rewrites.
219       * @return Number of children in the BodyDecl list.
220       * @apilevel low-level
221       */
222      public int getNumBodyDeclNoTransform() {
223        return getBodyDeclListNoTransform().getNumChildNoTransform();
224      }
225      /**
226       * Retrieves the element at index {@code i} in the BodyDecl list.
227       * @param i Index of the element to return.
228       * @return The element at position {@code i} in the BodyDecl list.
229       * @apilevel high-level
230       */
231      public BodyDecl getBodyDecl(int i) {
232        return (BodyDecl) getBodyDeclList().getChild(i);
233      }
234      /**
235       * Check whether the BodyDecl list has any children.
236       * @return {@code true} if it has at least one child, {@code false} otherwise.
237       * @apilevel high-level
238       */
239      public boolean hasBodyDecl() {
240        return getBodyDeclList().getNumChild() != 0;
241      }
242      /**
243       * Append an element to the BodyDecl list.
244       * @param node The element to append to the BodyDecl list.
245       * @apilevel high-level
246       */
247      public void addBodyDecl(BodyDecl node) {
248        List<BodyDecl> list = (parent == null) ? getBodyDeclListNoTransform() : getBodyDeclList();
249        list.addChild(node);
250      }
251      /**
252       * @apilevel low-level
253       */
254      public void addBodyDeclNoTransform(BodyDecl node) {
255        List<BodyDecl> list = getBodyDeclListNoTransform();
256        list.addChild(node);
257      }
258      /**
259       * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}.
260       * @param node The new node to replace the old list element.
261       * @param i The list index of the node to be replaced.
262       * @apilevel high-level
263       */
264      public void setBodyDecl(BodyDecl node, int i) {
265        List<BodyDecl> list = getBodyDeclList();
266        list.setChild(node, i);
267      }
268      /**
269       * Retrieves the BodyDecl list.
270       * @return The node representing the BodyDecl list.
271       * @apilevel high-level
272       */
273      @ASTNodeAnnotation.ListChild(name="BodyDecl")
274      public List<BodyDecl> getBodyDeclList() {
275        List<BodyDecl> list = (List<BodyDecl>) getChild(1);
276        return list;
277      }
278      /**
279       * Retrieves the BodyDecl list.
280       * <p><em>This method does not invoke AST transformations.</em></p>
281       * @return The node representing the BodyDecl list.
282       * @apilevel low-level
283       */
284      public List<BodyDecl> getBodyDeclListNoTransform() {
285        return (List<BodyDecl>) getChildNoTransform(1);
286      }
287      /**
288       * Retrieves the BodyDecl list.
289       * @return The node representing the BodyDecl list.
290       * @apilevel high-level
291       */
292      public List<BodyDecl> getBodyDecls() {
293        return getBodyDeclList();
294      }
295      /**
296       * Retrieves the BodyDecl list.
297       * <p><em>This method does not invoke AST transformations.</em></p>
298       * @return The node representing the BodyDecl list.
299       * @apilevel low-level
300       */
301      public List<BodyDecl> getBodyDeclsNoTransform() {
302        return getBodyDeclListNoTransform();
303      }
304      /**
305       * @attribute syn
306       * @aspect GenericsSubtype
307       * @declaredat /home/jesper/git/extendj/java5/frontend/GenericsSubtype.jrag:115
308       */
309      @ASTNodeAnnotation.Attribute
310      public boolean isWildcard() {
311        boolean isWildcard_value = true;
312    
313        return isWildcard_value;
314      }
315      /**
316       * A type is reifiable if it either refers to a non-parameterized type,
317       * is a raw type, is a parameterized type with only unbound wildcard
318       * parameters or is an array type with a reifiable type parameter.
319       * 
320       * @see "JLS SE7 &sect;4.7"
321       * @attribute syn
322       * @aspect ReifiableTypes
323       * @declaredat /home/jesper/git/extendj/java5/frontend/ReifiableTypes.jrag:39
324       */
325      @ASTNodeAnnotation.Attribute
326      public boolean isReifiable() {
327        boolean isReifiable_value = false;
328    
329        return isReifiable_value;
330      }
331      /**
332       * @apilevel internal
333       */
334      protected boolean needsSignatureAttribute_computed = false;
335      /**
336       * @apilevel internal
337       */
338      protected boolean needsSignatureAttribute_value;
339      /**
340       * @apilevel internal
341       */
342      private void needsSignatureAttribute_reset() {
343        needsSignatureAttribute_computed = false;
344      }
345      /**
346       * @attribute syn
347       * @aspect GenericsCodegen
348       * @declaredat /home/jesper/git/extendj/java5/backend/GenericsCodegen.jrag:345
349       */
350      @ASTNodeAnnotation.Attribute
351      public boolean needsSignatureAttribute() {
352        ASTNode$State state = state();
353        if (needsSignatureAttribute_computed) {
354          return needsSignatureAttribute_value;
355        }
356        boolean intermediate = state.INTERMEDIATE_VALUE;
357        state.INTERMEDIATE_VALUE = false;
358        int num = state.boundariesCrossed;
359        boolean isFinal = this.is$Final();
360        needsSignatureAttribute_value = true;
361        if (isFinal && num == state().boundariesCrossed) {
362          needsSignatureAttribute_computed = true;
363        } else {
364        }
365        state.INTERMEDIATE_VALUE |= intermediate;
366    
367        return needsSignatureAttribute_value;
368      }
369      /**
370       * @apilevel internal
371       */
372      public ASTNode rewriteTo() {
373        return super.rewriteTo();
374      }
375    }