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/Java.ast:96
027     * @production MemberClassDecl : {@link MemberTypeDecl} ::= <span class="component">{@link ClassDecl}</span>;
028    
029     */
030    public class MemberClassDecl extends MemberTypeDecl implements Cloneable {
031      /**
032       * @aspect Java4PrettyPrint
033       * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:299
034       */
035      public void prettyPrint(PrettyPrinter out) {
036        out.print(getClassDecl());
037      }
038      /**
039       * @declaredat ASTNode:1
040       */
041      public MemberClassDecl() {
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        children = new ASTNode[1];
053      }
054      /**
055       * @declaredat ASTNode:13
056       */
057      public MemberClassDecl(ClassDecl p0) {
058        setChild(p0, 0);
059      }
060      /**
061       * @apilevel low-level
062       * @declaredat ASTNode:19
063       */
064      protected int numChildren() {
065        return 1;
066      }
067      /**
068       * @apilevel internal
069       * @declaredat ASTNode:25
070       */
071      public boolean mayHaveRewrite() {
072        return false;
073      }
074      /**
075       * @apilevel internal
076       * @declaredat ASTNode:31
077       */
078      public void flushAttrCache() {
079        super.flushAttrCache();
080      }
081      /**
082       * @apilevel internal
083       * @declaredat ASTNode:37
084       */
085      public void flushCollectionCache() {
086        super.flushCollectionCache();
087      }
088      /**
089       * @apilevel internal
090       * @declaredat ASTNode:43
091       */
092      public void flushRewriteCache() {
093        super.flushRewriteCache();
094      }
095      /**
096       * @apilevel internal
097       * @declaredat ASTNode:49
098       */
099      public MemberClassDecl clone() throws CloneNotSupportedException {
100        MemberClassDecl node = (MemberClassDecl) super.clone();
101        return node;
102      }
103      /**
104       * @apilevel internal
105       * @declaredat ASTNode:56
106       */
107      public MemberClassDecl copy() {
108        try {
109          MemberClassDecl node = (MemberClassDecl) clone();
110          node.parent = null;
111          if (children != null) {
112            node.children = (ASTNode[]) children.clone();
113          }
114          return node;
115        } catch (CloneNotSupportedException e) {
116          throw new Error("Error: clone not supported for " + getClass().getName());
117        }
118      }
119      /**
120       * Create a deep copy of the AST subtree at this node.
121       * The copy is dangling, i.e. has no parent.
122       * @return dangling copy of the subtree at this node
123       * @apilevel low-level
124       * @deprecated Please use treeCopy or treeCopyNoTransform instead
125       * @declaredat ASTNode:75
126       */
127      @Deprecated
128      public MemberClassDecl fullCopy() {
129        return treeCopyNoTransform();
130      }
131      /**
132       * Create a deep copy of the AST subtree at this node.
133       * The copy is dangling, i.e. has no parent.
134       * @return dangling copy of the subtree at this node
135       * @apilevel low-level
136       * @declaredat ASTNode:85
137       */
138      public MemberClassDecl treeCopyNoTransform() {
139        MemberClassDecl tree = (MemberClassDecl) copy();
140        if (children != null) {
141          for (int i = 0; i < children.length; ++i) {
142            ASTNode child = (ASTNode) children[i];
143            if (child != null) {
144              child = child.treeCopyNoTransform();
145              tree.setChild(child, i);
146            }
147          }
148        }
149        return tree;
150      }
151      /**
152       * Create a deep copy of the AST subtree at this node.
153       * The subtree of this node is traversed to trigger rewrites before copy.
154       * The copy is dangling, i.e. has no parent.
155       * @return dangling copy of the subtree at this node
156       * @apilevel low-level
157       * @declaredat ASTNode:105
158       */
159      public MemberClassDecl treeCopy() {
160        doFullTraversal();
161        return treeCopyNoTransform();
162      }
163      /**
164       * @apilevel internal
165       * @declaredat ASTNode:112
166       */
167      protected boolean is$Equal(ASTNode node) {
168        return super.is$Equal(node);    
169      }
170      /**
171       * Replaces the ClassDecl child.
172       * @param node The new node to replace the ClassDecl child.
173       * @apilevel high-level
174       */
175      public void setClassDecl(ClassDecl node) {
176        setChild(node, 0);
177      }
178      /**
179       * Retrieves the ClassDecl child.
180       * @return The current node used as the ClassDecl child.
181       * @apilevel high-level
182       */
183      @ASTNodeAnnotation.Child(name="ClassDecl")
184      public ClassDecl getClassDecl() {
185        return (ClassDecl) getChild(0);
186      }
187      /**
188       * Retrieves the ClassDecl child.
189       * <p><em>This method does not invoke AST transformations.</em></p>
190       * @return The current node used as the ClassDecl child.
191       * @apilevel low-level
192       */
193      public ClassDecl getClassDeclNoTransform() {
194        return (ClassDecl) getChildNoTransform(0);
195      }
196      /**
197       * @attribute syn
198       * @aspect TypeScopePropagation
199       * @declaredat /home/jesper/git/extendj/java4/frontend/LookupType.jrag:604
200       */
201      @ASTNodeAnnotation.Attribute
202      public TypeDecl typeDecl() {
203        TypeDecl typeDecl_value = getClassDecl();
204    
205        return typeDecl_value;
206      }
207      /**
208       * @attribute syn
209       * @aspect PreciseRethrow
210       * @declaredat /home/jesper/git/extendj/java8/frontend/EffectivelyFinal.jrag:40
211       */
212      @ASTNodeAnnotation.Attribute
213      public boolean modifiedInScope(Variable var) {
214        boolean modifiedInScope_Variable_value = getClassDecl().modifiedInScope(var);
215    
216        return modifiedInScope_Variable_value;
217      }
218      /**
219       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:577
220       * @apilevel internal
221       */
222      public boolean Define_isMemberType(ASTNode caller, ASTNode child) {
223        if (caller == getClassDeclNoTransform()) {
224          // @declaredat /home/jesper/git/extendj/java4/frontend/TypeAnalysis.jrag:578
225          return true;
226        }
227        else {
228          return getParent().Define_isMemberType(this, caller);
229        }
230      }
231      protected boolean canDefine_isMemberType(ASTNode caller, ASTNode child) {
232        return true;
233      }
234      /**
235       * @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:182
236       * @apilevel internal
237       */
238      public boolean Define_inStaticContext(ASTNode caller, ASTNode child) {
239        if (caller == getClassDeclNoTransform()) {
240          // @declaredat /home/jesper/git/extendj/java4/frontend/TypeHierarchyCheck.jrag:194
241          return false;
242        }
243        else {
244          return getParent().Define_inStaticContext(this, caller);
245        }
246      }
247      protected boolean canDefine_inStaticContext(ASTNode caller, ASTNode child) {
248        return true;
249      }
250      /**
251       * @apilevel internal
252       */
253      public ASTNode rewriteTo() {
254        return super.rewriteTo();
255      }
256    }