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:187
027     * @production Modifier : {@link ASTNode} ::= <span class="component">&lt;ID:String&gt;</span>;
028    
029     */
030    public class Modifier extends ASTNode<ASTNode> implements Cloneable {
031      /**
032       * @aspect Java4PrettyPrint
033       * @declaredat /home/jesper/git/extendj/java4/frontend/PrettyPrint.jadd:104
034       */
035      public void prettyPrint(PrettyPrinter out) {
036        out.print(getID());
037      }
038      /**
039       * @declaredat ASTNode:1
040       */
041      public Modifier() {
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 Modifier(String p0) {
057        setID(p0);
058      }
059      /**
060       * @declaredat ASTNode:15
061       */
062      public Modifier(beaver.Symbol p0) {
063        setID(p0);
064      }
065      /**
066       * @apilevel low-level
067       * @declaredat ASTNode:21
068       */
069      protected int numChildren() {
070        return 0;
071      }
072      /**
073       * @apilevel internal
074       * @declaredat ASTNode:27
075       */
076      public boolean mayHaveRewrite() {
077        return false;
078      }
079      /**
080       * @apilevel internal
081       * @declaredat ASTNode:33
082       */
083      public void flushAttrCache() {
084        super.flushAttrCache();
085      }
086      /**
087       * @apilevel internal
088       * @declaredat ASTNode:39
089       */
090      public void flushCollectionCache() {
091        super.flushCollectionCache();
092      }
093      /**
094       * @apilevel internal
095       * @declaredat ASTNode:45
096       */
097      public void flushRewriteCache() {
098        super.flushRewriteCache();
099      }
100      /**
101       * @apilevel internal
102       * @declaredat ASTNode:51
103       */
104      public Modifier clone() throws CloneNotSupportedException {
105        Modifier node = (Modifier) super.clone();
106        return node;
107      }
108      /**
109       * @apilevel internal
110       * @declaredat ASTNode:58
111       */
112      public Modifier copy() {
113        try {
114          Modifier node = (Modifier) clone();
115          node.parent = null;
116          if (children != null) {
117            node.children = (ASTNode[]) children.clone();
118          }
119          return node;
120        } catch (CloneNotSupportedException e) {
121          throw new Error("Error: clone not supported for " + getClass().getName());
122        }
123      }
124      /**
125       * Create a deep copy of the AST subtree at this node.
126       * The copy is dangling, i.e. has no parent.
127       * @return dangling copy of the subtree at this node
128       * @apilevel low-level
129       * @deprecated Please use treeCopy or treeCopyNoTransform instead
130       * @declaredat ASTNode:77
131       */
132      @Deprecated
133      public Modifier fullCopy() {
134        return treeCopyNoTransform();
135      }
136      /**
137       * Create a deep copy of the AST subtree at this node.
138       * The copy is dangling, i.e. has no parent.
139       * @return dangling copy of the subtree at this node
140       * @apilevel low-level
141       * @declaredat ASTNode:87
142       */
143      public Modifier treeCopyNoTransform() {
144        Modifier tree = (Modifier) copy();
145        if (children != null) {
146          for (int i = 0; i < children.length; ++i) {
147            ASTNode child = (ASTNode) children[i];
148            if (child != null) {
149              child = child.treeCopyNoTransform();
150              tree.setChild(child, i);
151            }
152          }
153        }
154        return tree;
155      }
156      /**
157       * Create a deep copy of the AST subtree at this node.
158       * The subtree of this node is traversed to trigger rewrites before copy.
159       * The copy is dangling, i.e. has no parent.
160       * @return dangling copy of the subtree at this node
161       * @apilevel low-level
162       * @declaredat ASTNode:107
163       */
164      public Modifier treeCopy() {
165        doFullTraversal();
166        return treeCopyNoTransform();
167      }
168      /**
169       * @apilevel internal
170       * @declaredat ASTNode:114
171       */
172      protected boolean is$Equal(ASTNode node) {
173        return super.is$Equal(node) && (tokenString_ID == ((Modifier)node).tokenString_ID);    
174      }
175      /**
176       * Replaces the lexeme ID.
177       * @param value The new value for the lexeme ID.
178       * @apilevel high-level
179       */
180      public void setID(String value) {
181        tokenString_ID = value;
182      }
183      /**
184       * @apilevel internal
185       */
186      protected String tokenString_ID;
187      /**
188       */
189      public int IDstart;
190      /**
191       */
192      public int IDend;
193      /**
194       * JastAdd-internal setter for lexeme ID using the Beaver parser.
195       * @param symbol Symbol containing the new value for the lexeme ID
196       * @apilevel internal
197       */
198      public void setID(beaver.Symbol symbol) {
199        if (symbol.value != null && !(symbol.value instanceof String))
200        throw new UnsupportedOperationException("setID is only valid for String lexemes");
201        tokenString_ID = (String)symbol.value;
202        IDstart = symbol.getStart();
203        IDend = symbol.getEnd();
204      }
205      /**
206       * Retrieves the value for the lexeme ID.
207       * @return The value for the lexeme ID.
208       * @apilevel high-level
209       */
210      @ASTNodeAnnotation.Token(name="ID")
211      public String getID() {
212        return tokenString_ID != null ? tokenString_ID : "";
213      }
214      /**
215       * @attribute syn
216       * @aspect Annotations
217       * @declaredat /home/jesper/git/extendj/java5/frontend/Annotations.jrag:285
218       */
219      @ASTNodeAnnotation.Attribute
220      public boolean isAnnotation(String packageName, String name) {
221        boolean isAnnotation_String_String_value = false;
222    
223        return isAnnotation_String_String_value;
224      }
225      /**
226       * @attribute syn
227       * @aspect AnnotationsCodegen
228       * @declaredat /home/jesper/git/extendj/java5/backend/AnnotationsCodegen.jrag:88
229       */
230      @ASTNodeAnnotation.Attribute
231      public boolean isRuntimeVisible() {
232        boolean isRuntimeVisible_value = false;
233    
234        return isRuntimeVisible_value;
235      }
236      /**
237       * @attribute syn
238       * @aspect AnnotationsCodegen
239       * @declaredat /home/jesper/git/extendj/java5/backend/AnnotationsCodegen.jrag:100
240       */
241      @ASTNodeAnnotation.Attribute
242      public boolean isRuntimeInvisible() {
243        boolean isRuntimeInvisible_value = false;
244    
245        return isRuntimeInvisible_value;
246      }
247      /**
248       * @apilevel internal
249       */
250      public ASTNode rewriteTo() {
251        return super.rewriteTo();
252      }
253    }