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:201
027     * @production DefaultCase : {@link Case};
028    
029     */
030    public class DefaultCase extends Case implements Cloneable {
031      /**
032       * @aspect NameCheck
033       * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:490
034       */
035      public void nameCheck() {
036        if (bind(this) != this) {
037          error("only one default case statement allowed");
038        }
039      }
040      /**
041       * @aspect Java4PrettyPrint
042       * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:261
043       */
044      public void prettyPrint(PrettyPrinter out) {
045        out.print("default:");
046      }
047      /**
048       * @declaredat ASTNode:1
049       */
050      public DefaultCase() {
051        super();
052      }
053      /**
054       * Initializes the child array to the correct size.
055       * Initializes List and Opt nta children.
056       * @apilevel internal
057       * @ast method
058       * @declaredat ASTNode:10
059       */
060      public void init$Children() {
061      }
062      /**
063       * @apilevel low-level
064       * @declaredat ASTNode:15
065       */
066      protected int numChildren() {
067        return 0;
068      }
069      /**
070       * @apilevel internal
071       * @declaredat ASTNode:21
072       */
073      public boolean mayHaveRewrite() {
074        return false;
075      }
076      /**
077       * @apilevel internal
078       * @declaredat ASTNode:27
079       */
080      public void flushAttrCache() {
081        super.flushAttrCache();
082      }
083      /**
084       * @apilevel internal
085       * @declaredat ASTNode:33
086       */
087      public void flushCollectionCache() {
088        super.flushCollectionCache();
089      }
090      /**
091       * @apilevel internal
092       * @declaredat ASTNode:39
093       */
094      public void flushRewriteCache() {
095        super.flushRewriteCache();
096      }
097      /**
098       * @apilevel internal
099       * @declaredat ASTNode:45
100       */
101      public DefaultCase clone() throws CloneNotSupportedException {
102        DefaultCase node = (DefaultCase) super.clone();
103        return node;
104      }
105      /**
106       * @apilevel internal
107       * @declaredat ASTNode:52
108       */
109      public DefaultCase copy() {
110        try {
111          DefaultCase node = (DefaultCase) 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:71
128       */
129      @Deprecated
130      public DefaultCase 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:81
139       */
140      public DefaultCase treeCopyNoTransform() {
141        DefaultCase tree = (DefaultCase) 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:101
160       */
161      public DefaultCase treeCopy() {
162        doFullTraversal();
163        return treeCopyNoTransform();
164      }
165      /**
166       * @apilevel internal
167       * @declaredat ASTNode:108
168       */
169      protected boolean is$Equal(ASTNode node) {
170        return super.is$Equal(node);    
171      }
172      /**
173       * @attribute syn
174       * @aspect NameCheck
175       * @declaredat /home/jesper/git/extendj/java4/frontend/NameCheck.jrag:512
176       */
177      @ASTNodeAnnotation.Attribute
178      public boolean constValue(Case c) {
179        boolean constValue_Case_value = c instanceof DefaultCase;
180    
181        return constValue_Case_value;
182      }
183      /**
184       * @attribute syn
185       * @aspect StringsInSwitch
186       * @declaredat /home/jesper/git/extendj/java7/frontend/StringsInSwitch.jrag:59
187       */
188      @ASTNodeAnnotation.Attribute
189      public boolean isDefaultCase() {
190        boolean isDefaultCase_value = true;
191    
192        return isDefaultCase_value;
193      }
194      /**
195       * @apilevel internal
196       */
197      public ASTNode rewriteTo() {
198        return super.rewriteTo();
199      }
200    }