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:21
027     * @production Wildcard : {@link AbstractWildcard};
028    
029     */
030    public class Wildcard extends AbstractWildcard implements Cloneable {
031      /**
032       * @aspect Java5PrettyPrint
033       * @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:165
034       */
035      public void prettyPrint(PrettyPrinter out) {
036        out.print("?");
037      }
038      /**
039       * @declaredat ASTNode:1
040       */
041      public Wildcard() {
042        super();
043      }
044      /**
045       * Initializes the child array to the correct size.
046       * Initializes List and Opt nta children.
047       * @apilevel internal
048       * @ast method
049       * @declaredat ASTNode:10
050       */
051      public void init$Children() {
052      }
053      /**
054       * @apilevel low-level
055       * @declaredat ASTNode:15
056       */
057      protected int numChildren() {
058        return 0;
059      }
060      /**
061       * @apilevel internal
062       * @declaredat ASTNode:21
063       */
064      public boolean mayHaveRewrite() {
065        return false;
066      }
067      /**
068       * @apilevel internal
069       * @declaredat ASTNode:27
070       */
071      public void flushAttrCache() {
072        super.flushAttrCache();
073        type_reset();
074      }
075      /**
076       * @apilevel internal
077       * @declaredat ASTNode:34
078       */
079      public void flushCollectionCache() {
080        super.flushCollectionCache();
081      }
082      /**
083       * @apilevel internal
084       * @declaredat ASTNode:40
085       */
086      public void flushRewriteCache() {
087        super.flushRewriteCache();
088      }
089      /**
090       * @apilevel internal
091       * @declaredat ASTNode:46
092       */
093      public Wildcard clone() throws CloneNotSupportedException {
094        Wildcard node = (Wildcard) super.clone();
095        return node;
096      }
097      /**
098       * @apilevel internal
099       * @declaredat ASTNode:53
100       */
101      public Wildcard copy() {
102        try {
103          Wildcard node = (Wildcard) clone();
104          node.parent = null;
105          if (children != null) {
106            node.children = (ASTNode[]) children.clone();
107          }
108          return node;
109        } catch (CloneNotSupportedException e) {
110          throw new Error("Error: clone not supported for " + getClass().getName());
111        }
112      }
113      /**
114       * Create a deep copy of the AST subtree at this node.
115       * The copy is dangling, i.e. has no parent.
116       * @return dangling copy of the subtree at this node
117       * @apilevel low-level
118       * @deprecated Please use treeCopy or treeCopyNoTransform instead
119       * @declaredat ASTNode:72
120       */
121      @Deprecated
122      public Wildcard fullCopy() {
123        return treeCopyNoTransform();
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       * @declaredat ASTNode:82
131       */
132      public Wildcard treeCopyNoTransform() {
133        Wildcard tree = (Wildcard) copy();
134        if (children != null) {
135          for (int i = 0; i < children.length; ++i) {
136            ASTNode child = (ASTNode) children[i];
137            if (child != null) {
138              child = child.treeCopyNoTransform();
139              tree.setChild(child, i);
140            }
141          }
142        }
143        return tree;
144      }
145      /**
146       * Create a deep copy of the AST subtree at this node.
147       * The subtree of this node is traversed to trigger rewrites before copy.
148       * The copy is dangling, i.e. has no parent.
149       * @return dangling copy of the subtree at this node
150       * @apilevel low-level
151       * @declaredat ASTNode:102
152       */
153      public Wildcard treeCopy() {
154        doFullTraversal();
155        return treeCopyNoTransform();
156      }
157      /**
158       * @apilevel internal
159       * @declaredat ASTNode:109
160       */
161      protected boolean is$Equal(ASTNode node) {
162        return super.is$Equal(node);    
163      }
164      /**
165       * @apilevel internal
166       */
167      protected boolean type_computed = false;
168      /**
169       * @apilevel internal
170       */
171      protected TypeDecl type_value;
172      /**
173       * @apilevel internal
174       */
175      private void type_reset() {
176        type_computed = false;
177        type_value = null;
178      }
179      /**
180       * @attribute syn
181       * @aspect TypeAnalysis
182       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:302
183       */
184      @ASTNodeAnnotation.Attribute
185      public TypeDecl type() {
186        ASTNode$State state = state();
187        if (type_computed) {
188          return type_value;
189        }
190        boolean intermediate = state.INTERMEDIATE_VALUE;
191        state.INTERMEDIATE_VALUE = false;
192        int num = state.boundariesCrossed;
193        boolean isFinal = this.is$Final();
194        type_value = typeWildcard();
195        if (isFinal && num == state().boundariesCrossed) {
196          type_computed = true;
197        } else {
198        }
199        state.INTERMEDIATE_VALUE |= intermediate;
200    
201        return type_value;
202      }
203      /**
204       * WARNING: this attribute is not the same as TypeDecl.isWildcard,
205       * which returns true for any wildcard type (even bounded wildcard types).
206       * @return {@code true} if this is an unbounded wildcard access
207       * @attribute syn
208       * @aspect ReifiableTypes
209       * @declaredat /home/jesper/git/extendj/java5/frontend/ReifiableTypes.jrag:106
210       */
211      @ASTNodeAnnotation.Attribute
212      public boolean isWildcard() {
213        boolean isWildcard_value = true;
214    
215        return isWildcard_value;
216      }
217      /**
218       * @attribute inh
219       * @aspect LookupParTypeDecl
220       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1480
221       */
222      /**
223       * @attribute inh
224       * @aspect LookupParTypeDecl
225       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1480
226       */
227      @ASTNodeAnnotation.Attribute
228      public TypeDecl typeWildcard() {
229        TypeDecl typeWildcard_value = getParent().Define_typeWildcard(this, null);
230    
231        return typeWildcard_value;
232      }
233      /**
234       * @apilevel internal
235       */
236      public ASTNode rewriteTo() {
237        return super.rewriteTo();
238      }
239    }