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:22
027     * @production WildcardExtends : {@link AbstractWildcard} ::= <span class="component">{@link Access}</span>;
028    
029     */
030    public class WildcardExtends extends AbstractWildcard implements Cloneable {
031      /**
032       * @aspect Java5PrettyPrint
033       * @declaredat /home/jesper/git/extendj/java5/frontend/PrettyPrint.jadd:224
034       */
035      public void prettyPrint(PrettyPrinter out) {
036        out.print("? extends ");
037        out.print(getAccess());
038      }
039      /**
040       * @declaredat ASTNode:1
041       */
042      public WildcardExtends() {
043        super();
044      }
045      /**
046       * Initializes the child array to the correct size.
047       * Initializes List and Opt nta children.
048       * @apilevel internal
049       * @ast method
050       * @declaredat ASTNode:10
051       */
052      public void init$Children() {
053        children = new ASTNode[1];
054      }
055      /**
056       * @declaredat ASTNode:13
057       */
058      public WildcardExtends(Access p0) {
059        setChild(p0, 0);
060      }
061      /**
062       * @apilevel low-level
063       * @declaredat ASTNode:19
064       */
065      protected int numChildren() {
066        return 1;
067      }
068      /**
069       * @apilevel internal
070       * @declaredat ASTNode:25
071       */
072      public boolean mayHaveRewrite() {
073        return false;
074      }
075      /**
076       * @apilevel internal
077       * @declaredat ASTNode:31
078       */
079      public void flushAttrCache() {
080        super.flushAttrCache();
081        type_reset();
082      }
083      /**
084       * @apilevel internal
085       * @declaredat ASTNode:38
086       */
087      public void flushCollectionCache() {
088        super.flushCollectionCache();
089      }
090      /**
091       * @apilevel internal
092       * @declaredat ASTNode:44
093       */
094      public void flushRewriteCache() {
095        super.flushRewriteCache();
096      }
097      /**
098       * @apilevel internal
099       * @declaredat ASTNode:50
100       */
101      public WildcardExtends clone() throws CloneNotSupportedException {
102        WildcardExtends node = (WildcardExtends) super.clone();
103        return node;
104      }
105      /**
106       * @apilevel internal
107       * @declaredat ASTNode:57
108       */
109      public WildcardExtends copy() {
110        try {
111          WildcardExtends node = (WildcardExtends) clone();
112          node.parent = null;
113          if (children != null) {
114            node.children = (ASTNode[]) children.clone();
115          }
116          return node;
117        } catch (CloneNotSupportedException e) {
118          throw new Error("Error: clone not supported for " + getClass().getName());
119        }
120      }
121      /**
122       * Create a deep copy of the AST subtree at this node.
123       * The copy is dangling, i.e. has no parent.
124       * @return dangling copy of the subtree at this node
125       * @apilevel low-level
126       * @deprecated Please use treeCopy or treeCopyNoTransform instead
127       * @declaredat ASTNode:76
128       */
129      @Deprecated
130      public WildcardExtends fullCopy() {
131        return treeCopyNoTransform();
132      }
133      /**
134       * Create a deep copy of the AST subtree at this node.
135       * The copy is dangling, i.e. has no parent.
136       * @return dangling copy of the subtree at this node
137       * @apilevel low-level
138       * @declaredat ASTNode:86
139       */
140      public WildcardExtends treeCopyNoTransform() {
141        WildcardExtends tree = (WildcardExtends) copy();
142        if (children != null) {
143          for (int i = 0; i < children.length; ++i) {
144            ASTNode child = (ASTNode) children[i];
145            if (child != null) {
146              child = child.treeCopyNoTransform();
147              tree.setChild(child, i);
148            }
149          }
150        }
151        return tree;
152      }
153      /**
154       * Create a deep copy of the AST subtree at this node.
155       * The subtree of this node is traversed to trigger rewrites before copy.
156       * The copy is dangling, i.e. has no parent.
157       * @return dangling copy of the subtree at this node
158       * @apilevel low-level
159       * @declaredat ASTNode:106
160       */
161      public WildcardExtends treeCopy() {
162        doFullTraversal();
163        return treeCopyNoTransform();
164      }
165      /**
166       * @apilevel internal
167       * @declaredat ASTNode:113
168       */
169      protected boolean is$Equal(ASTNode node) {
170        return super.is$Equal(node);    
171      }
172      /**
173       * Replaces the Access child.
174       * @param node The new node to replace the Access child.
175       * @apilevel high-level
176       */
177      public void setAccess(Access node) {
178        setChild(node, 0);
179      }
180      /**
181       * Retrieves the Access child.
182       * @return The current node used as the Access child.
183       * @apilevel high-level
184       */
185      @ASTNodeAnnotation.Child(name="Access")
186      public Access getAccess() {
187        return (Access) getChild(0);
188      }
189      /**
190       * Retrieves the Access child.
191       * <p><em>This method does not invoke AST transformations.</em></p>
192       * @return The current node used as the Access child.
193       * @apilevel low-level
194       */
195      public Access getAccessNoTransform() {
196        return (Access) getChildNoTransform(0);
197      }
198      /**
199       * @apilevel internal
200       */
201      protected boolean type_computed = false;
202      /**
203       * @apilevel internal
204       */
205      protected TypeDecl type_value;
206      /**
207       * @apilevel internal
208       */
209      private void type_reset() {
210        type_computed = false;
211        type_value = null;
212      }
213      /**
214       * @attribute syn
215       * @aspect TypeAnalysis
216       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:302
217       */
218      @ASTNodeAnnotation.Attribute
219      public TypeDecl type() {
220        ASTNode$State state = state();
221        if (type_computed) {
222          return type_value;
223        }
224        boolean intermediate = state.INTERMEDIATE_VALUE;
225        state.INTERMEDIATE_VALUE = false;
226        int num = state.boundariesCrossed;
227        boolean isFinal = this.is$Final();
228        type_value = lookupWildcardExtends(getAccess().type());
229        if (isFinal && num == state().boundariesCrossed) {
230          type_computed = true;
231        } else {
232        }
233        state.INTERMEDIATE_VALUE |= intermediate;
234    
235        return type_value;
236      }
237      /**
238       * @attribute inh
239       * @aspect LookupParTypeDecl
240       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1479
241       */
242      /**
243       * @attribute inh
244       * @aspect LookupParTypeDecl
245       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:1479
246       */
247      @ASTNodeAnnotation.Attribute
248      public TypeDecl lookupWildcardExtends(TypeDecl typeDecl) {
249        TypeDecl lookupWildcardExtends_TypeDecl_value = getParent().Define_lookupWildcardExtends(this, null, typeDecl);
250    
251        return lookupWildcardExtends_TypeDecl_value;
252      }
253      /**
254       * @apilevel internal
255       */
256      public ASTNode rewriteTo() {
257        return super.rewriteTo();
258      }
259    }