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/BoundNames.ast:8
027     * @production BoundTypeAccess : {@link TypeAccess} ::= <span class="component">&lt;TypeDecl:TypeDecl&gt;</span>;
028    
029     */
030    public class BoundTypeAccess extends TypeAccess implements Cloneable {
031      /**
032       * @aspect GenericsTypeAnalysis
033       * @declaredat /home/jesper/git/extendj/java5/frontend/Generics.jrag:412
034       */
035      public boolean isRaw() {
036        return getTypeDecl().isRawType();
037      }
038      /**
039       * @declaredat ASTNode:1
040       */
041      public BoundTypeAccess() {
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       * @declaredat ASTNode:12
055       */
056      public BoundTypeAccess(String p0, String p1, TypeDecl p2) {
057        setPackage(p0);
058        setID(p1);
059        setTypeDecl(p2);
060      }
061      /**
062       * @declaredat ASTNode:17
063       */
064      public BoundTypeAccess(beaver.Symbol p0, beaver.Symbol p1, TypeDecl p2) {
065        setPackage(p0);
066        setID(p1);
067        setTypeDecl(p2);
068      }
069      /**
070       * @apilevel low-level
071       * @declaredat ASTNode:25
072       */
073      protected int numChildren() {
074        return 0;
075      }
076      /**
077       * @apilevel internal
078       * @declaredat ASTNode:31
079       */
080      public boolean mayHaveRewrite() {
081        return false;
082      }
083      /**
084       * @apilevel internal
085       * @declaredat ASTNode:37
086       */
087      public void flushAttrCache() {
088        super.flushAttrCache();
089        decls_reset();
090      }
091      /**
092       * @apilevel internal
093       * @declaredat ASTNode:44
094       */
095      public void flushCollectionCache() {
096        super.flushCollectionCache();
097      }
098      /**
099       * @apilevel internal
100       * @declaredat ASTNode:50
101       */
102      public void flushRewriteCache() {
103        super.flushRewriteCache();
104      }
105      /**
106       * @apilevel internal
107       * @declaredat ASTNode:56
108       */
109      public BoundTypeAccess clone() throws CloneNotSupportedException {
110        BoundTypeAccess node = (BoundTypeAccess) super.clone();
111        return node;
112      }
113      /**
114       * @apilevel internal
115       * @declaredat ASTNode:63
116       */
117      public BoundTypeAccess copy() {
118        try {
119          BoundTypeAccess node = (BoundTypeAccess) clone();
120          node.parent = null;
121          if (children != null) {
122            node.children = (ASTNode[]) children.clone();
123          }
124          return node;
125        } catch (CloneNotSupportedException e) {
126          throw new Error("Error: clone not supported for " + getClass().getName());
127        }
128      }
129      /**
130       * Create a deep copy of the AST subtree at this node.
131       * The copy is dangling, i.e. has no parent.
132       * @return dangling copy of the subtree at this node
133       * @apilevel low-level
134       * @deprecated Please use treeCopy or treeCopyNoTransform instead
135       * @declaredat ASTNode:82
136       */
137      @Deprecated
138      public BoundTypeAccess fullCopy() {
139        return treeCopyNoTransform();
140      }
141      /**
142       * Create a deep copy of the AST subtree at this node.
143       * The copy is dangling, i.e. has no parent.
144       * @return dangling copy of the subtree at this node
145       * @apilevel low-level
146       * @declaredat ASTNode:92
147       */
148      public BoundTypeAccess treeCopyNoTransform() {
149        BoundTypeAccess tree = (BoundTypeAccess) copy();
150        if (children != null) {
151          for (int i = 0; i < children.length; ++i) {
152            ASTNode child = (ASTNode) children[i];
153            if (child != null) {
154              child = child.treeCopyNoTransform();
155              tree.setChild(child, i);
156            }
157          }
158        }
159        return tree;
160      }
161      /**
162       * Create a deep copy of the AST subtree at this node.
163       * The subtree of this node is traversed to trigger rewrites before copy.
164       * The copy is dangling, i.e. has no parent.
165       * @return dangling copy of the subtree at this node
166       * @apilevel low-level
167       * @declaredat ASTNode:112
168       */
169      public BoundTypeAccess treeCopy() {
170        doFullTraversal();
171        return treeCopyNoTransform();
172      }
173      /**
174       * @apilevel internal
175       * @declaredat ASTNode:119
176       */
177      protected boolean is$Equal(ASTNode node) {
178        return super.is$Equal(node) && (tokenString_Package == ((BoundTypeAccess)node).tokenString_Package) && (tokenString_ID == ((BoundTypeAccess)node).tokenString_ID) && (tokenTypeDecl_TypeDecl == ((BoundTypeAccess)node).tokenTypeDecl_TypeDecl);    
179      }
180      /**
181       * Replaces the lexeme Package.
182       * @param value The new value for the lexeme Package.
183       * @apilevel high-level
184       */
185      public void setPackage(String value) {
186        tokenString_Package = value;
187      }
188      /**
189       * JastAdd-internal setter for lexeme Package using the Beaver parser.
190       * @param symbol Symbol containing the new value for the lexeme Package
191       * @apilevel internal
192       */
193      public void setPackage(beaver.Symbol symbol) {
194        if (symbol.value != null && !(symbol.value instanceof String))
195        throw new UnsupportedOperationException("setPackage is only valid for String lexemes");
196        tokenString_Package = (String)symbol.value;
197        Packagestart = symbol.getStart();
198        Packageend = symbol.getEnd();
199      }
200      /**
201       * Retrieves the value for the lexeme Package.
202       * @return The value for the lexeme Package.
203       * @apilevel high-level
204       */
205      @ASTNodeAnnotation.Token(name="Package")
206      public String getPackage() {
207        return tokenString_Package != null ? tokenString_Package : "";
208      }
209      /**
210       * Replaces the lexeme ID.
211       * @param value The new value for the lexeme ID.
212       * @apilevel high-level
213       */
214      public void setID(String value) {
215        tokenString_ID = value;
216      }
217      /**
218       * JastAdd-internal setter for lexeme ID using the Beaver parser.
219       * @param symbol Symbol containing the new value for the lexeme ID
220       * @apilevel internal
221       */
222      public void setID(beaver.Symbol symbol) {
223        if (symbol.value != null && !(symbol.value instanceof String))
224        throw new UnsupportedOperationException("setID is only valid for String lexemes");
225        tokenString_ID = (String)symbol.value;
226        IDstart = symbol.getStart();
227        IDend = symbol.getEnd();
228      }
229      /**
230       * Retrieves the value for the lexeme ID.
231       * @return The value for the lexeme ID.
232       * @apilevel high-level
233       */
234      @ASTNodeAnnotation.Token(name="ID")
235      public String getID() {
236        return tokenString_ID != null ? tokenString_ID : "";
237      }
238      /**
239       * Replaces the lexeme TypeDecl.
240       * @param value The new value for the lexeme TypeDecl.
241       * @apilevel high-level
242       */
243      public void setTypeDecl(TypeDecl value) {
244        tokenTypeDecl_TypeDecl = value;
245      }
246      /**
247       * @apilevel internal
248       */
249      protected TypeDecl tokenTypeDecl_TypeDecl;
250      /**
251       * Retrieves the value for the lexeme TypeDecl.
252       * @return The value for the lexeme TypeDecl.
253       * @apilevel high-level
254       */
255      @ASTNodeAnnotation.Token(name="TypeDecl")
256      public TypeDecl getTypeDecl() {
257        return tokenTypeDecl_TypeDecl;
258      }
259      /**
260       * @apilevel internal
261       */
262      protected boolean decls_computed = false;
263      /**
264       * @apilevel internal
265       */
266      protected SimpleSet decls_value;
267      /**
268       * @apilevel internal
269       */
270      private void decls_reset() {
271        decls_computed = false;
272        decls_value = null;
273      }
274      /**
275       * @attribute syn
276       * @aspect TypeScopePropagation
277       * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:291
278       */
279      @ASTNodeAnnotation.Attribute
280      public SimpleSet decls() {
281        ASTNode$State state = state();
282        if (decls_computed) {
283          return decls_value;
284        }
285        boolean intermediate = state.INTERMEDIATE_VALUE;
286        state.INTERMEDIATE_VALUE = false;
287        int num = state.boundariesCrossed;
288        boolean isFinal = this.is$Final();
289        decls_value = SimpleSet.emptySet.add(getTypeDecl());
290        if (isFinal && num == state().boundariesCrossed) {
291          decls_computed = true;
292        } else {
293        }
294        state.INTERMEDIATE_VALUE |= intermediate;
295    
296        return decls_value;
297      }
298      /**
299       * WARNING: this attribute is not the same as TypeDecl.isWildcard,
300       * which returns true for any wildcard type (even bounded wildcard types).
301       * @return {@code true} if this is an unbounded wildcard access
302       * @attribute syn
303       * @aspect ReifiableTypes
304       * @declaredat /home/jesper/git/extendj/java5/frontend/ReifiableTypes.jrag:106
305       */
306      @ASTNodeAnnotation.Attribute
307      public boolean isWildcard() {
308        boolean isWildcard_value = getTypeDecl() instanceof WildcardType;
309    
310        return isWildcard_value;
311      }
312      /**
313       * @apilevel internal
314       */
315      public ASTNode rewriteTo() {
316        return super.rewriteTo();
317      }
318    }