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:58
027     * @production FloatingPointType : {@link NumericType};
028    
029     */
030    public class FloatingPointType extends NumericType implements Cloneable {
031      /**
032       * @declaredat ASTNode:1
033       */
034      public FloatingPointType() {
035        super();
036      }
037      /**
038       * Initializes the child array to the correct size.
039       * Initializes List and Opt nta children.
040       * @apilevel internal
041       * @ast method
042       * @declaredat ASTNode:10
043       */
044      public void init$Children() {
045        children = new ASTNode[3];
046        setChild(new Opt(), 1);
047        setChild(new List(), 2);
048      }
049      /**
050       * @declaredat ASTNode:15
051       */
052      public FloatingPointType(Modifiers p0, String p1, Opt<Access> p2, List<BodyDecl> p3) {
053        setChild(p0, 0);
054        setID(p1);
055        setChild(p2, 1);
056        setChild(p3, 2);
057      }
058      /**
059       * @declaredat ASTNode:21
060       */
061      public FloatingPointType(Modifiers p0, beaver.Symbol p1, Opt<Access> p2, List<BodyDecl> p3) {
062        setChild(p0, 0);
063        setID(p1);
064        setChild(p2, 1);
065        setChild(p3, 2);
066      }
067      /**
068       * @apilevel low-level
069       * @declaredat ASTNode:30
070       */
071      protected int numChildren() {
072        return 3;
073      }
074      /**
075       * @apilevel internal
076       * @declaredat ASTNode:36
077       */
078      public boolean mayHaveRewrite() {
079        return false;
080      }
081      /**
082       * @apilevel internal
083       * @declaredat ASTNode:42
084       */
085      public void flushAttrCache() {
086        super.flushAttrCache();
087      }
088      /**
089       * @apilevel internal
090       * @declaredat ASTNode:48
091       */
092      public void flushCollectionCache() {
093        super.flushCollectionCache();
094      }
095      /**
096       * @apilevel internal
097       * @declaredat ASTNode:54
098       */
099      public void flushRewriteCache() {
100        super.flushRewriteCache();
101      }
102      /**
103       * @apilevel internal
104       * @declaredat ASTNode:60
105       */
106      public FloatingPointType clone() throws CloneNotSupportedException {
107        FloatingPointType node = (FloatingPointType) super.clone();
108        return node;
109      }
110      /**
111       * @apilevel internal
112       * @declaredat ASTNode:67
113       */
114      public FloatingPointType copy() {
115        try {
116          FloatingPointType node = (FloatingPointType) clone();
117          node.parent = null;
118          if (children != null) {
119            node.children = (ASTNode[]) children.clone();
120          }
121          return node;
122        } catch (CloneNotSupportedException e) {
123          throw new Error("Error: clone not supported for " + getClass().getName());
124        }
125      }
126      /**
127       * Create a deep copy of the AST subtree at this node.
128       * The copy is dangling, i.e. has no parent.
129       * @return dangling copy of the subtree at this node
130       * @apilevel low-level
131       * @deprecated Please use treeCopy or treeCopyNoTransform instead
132       * @declaredat ASTNode:86
133       */
134      @Deprecated
135      public FloatingPointType fullCopy() {
136        return treeCopyNoTransform();
137      }
138      /**
139       * Create a deep copy of the AST subtree at this node.
140       * The copy is dangling, i.e. has no parent.
141       * @return dangling copy of the subtree at this node
142       * @apilevel low-level
143       * @declaredat ASTNode:96
144       */
145      public FloatingPointType treeCopyNoTransform() {
146        FloatingPointType tree = (FloatingPointType) copy();
147        if (children != null) {
148          for (int i = 0; i < children.length; ++i) {
149            ASTNode child = (ASTNode) children[i];
150            if (child != null) {
151              child = child.treeCopyNoTransform();
152              tree.setChild(child, i);
153            }
154          }
155        }
156        return tree;
157      }
158      /**
159       * Create a deep copy of the AST subtree at this node.
160       * The subtree of this node is traversed to trigger rewrites before copy.
161       * The copy is dangling, i.e. has no parent.
162       * @return dangling copy of the subtree at this node
163       * @apilevel low-level
164       * @declaredat ASTNode:116
165       */
166      public FloatingPointType treeCopy() {
167        doFullTraversal();
168        return treeCopyNoTransform();
169      }
170      /**
171       * @apilevel internal
172       * @declaredat ASTNode:123
173       */
174      protected boolean is$Equal(ASTNode node) {
175        return super.is$Equal(node) && (tokenString_ID == ((FloatingPointType)node).tokenString_ID);    
176      }
177      /**
178       * Replaces the Modifiers child.
179       * @param node The new node to replace the Modifiers child.
180       * @apilevel high-level
181       */
182      public void setModifiers(Modifiers node) {
183        setChild(node, 0);
184      }
185      /**
186       * Retrieves the Modifiers child.
187       * @return The current node used as the Modifiers child.
188       * @apilevel high-level
189       */
190      @ASTNodeAnnotation.Child(name="Modifiers")
191      public Modifiers getModifiers() {
192        return (Modifiers) getChild(0);
193      }
194      /**
195       * Retrieves the Modifiers child.
196       * <p><em>This method does not invoke AST transformations.</em></p>
197       * @return The current node used as the Modifiers child.
198       * @apilevel low-level
199       */
200      public Modifiers getModifiersNoTransform() {
201        return (Modifiers) getChildNoTransform(0);
202      }
203      /**
204       * Replaces the lexeme ID.
205       * @param value The new value for the lexeme ID.
206       * @apilevel high-level
207       */
208      public void setID(String value) {
209        tokenString_ID = value;
210      }
211      /**
212       * JastAdd-internal setter for lexeme ID using the Beaver parser.
213       * @param symbol Symbol containing the new value for the lexeme ID
214       * @apilevel internal
215       */
216      public void setID(beaver.Symbol symbol) {
217        if (symbol.value != null && !(symbol.value instanceof String))
218        throw new UnsupportedOperationException("setID is only valid for String lexemes");
219        tokenString_ID = (String)symbol.value;
220        IDstart = symbol.getStart();
221        IDend = symbol.getEnd();
222      }
223      /**
224       * Retrieves the value for the lexeme ID.
225       * @return The value for the lexeme ID.
226       * @apilevel high-level
227       */
228      @ASTNodeAnnotation.Token(name="ID")
229      public String getID() {
230        return tokenString_ID != null ? tokenString_ID : "";
231      }
232      /**
233       * Replaces the optional node for the SuperClass child. This is the <code>Opt</code>
234       * node containing the child SuperClass, not the actual child!
235       * @param opt The new node to be used as the optional node for the SuperClass child.
236       * @apilevel low-level
237       */
238      public void setSuperClassOpt(Opt<Access> opt) {
239        setChild(opt, 1);
240      }
241      /**
242       * Replaces the (optional) SuperClass child.
243       * @param node The new node to be used as the SuperClass child.
244       * @apilevel high-level
245       */
246      public void setSuperClass(Access node) {
247        getSuperClassOpt().setChild(node, 0);
248      }
249      /**
250       * Check whether the optional SuperClass child exists.
251       * @return {@code true} if the optional SuperClass child exists, {@code false} if it does not.
252       * @apilevel high-level
253       */
254      public boolean hasSuperClass() {
255        return getSuperClassOpt().getNumChild() != 0;
256      }
257      /**
258       * Retrieves the (optional) SuperClass child.
259       * @return The SuperClass child, if it exists. Returns {@code null} otherwise.
260       * @apilevel low-level
261       */
262      public Access getSuperClass() {
263        return (Access) getSuperClassOpt().getChild(0);
264      }
265      /**
266       * Retrieves the optional node for the SuperClass child. This is the <code>Opt</code> node containing the child SuperClass, not the actual child!
267       * @return The optional node for child the SuperClass child.
268       * @apilevel low-level
269       */
270      @ASTNodeAnnotation.OptChild(name="SuperClass")
271      public Opt<Access> getSuperClassOpt() {
272        return (Opt<Access>) getChild(1);
273      }
274      /**
275       * Retrieves the optional node for child SuperClass. This is the <code>Opt</code> node containing the child SuperClass, not the actual child!
276       * <p><em>This method does not invoke AST transformations.</em></p>
277       * @return The optional node for child SuperClass.
278       * @apilevel low-level
279       */
280      public Opt<Access> getSuperClassOptNoTransform() {
281        return (Opt<Access>) getChildNoTransform(1);
282      }
283      /**
284       * Replaces the BodyDecl list.
285       * @param list The new list node to be used as the BodyDecl list.
286       * @apilevel high-level
287       */
288      public void setBodyDeclList(List<BodyDecl> list) {
289        setChild(list, 2);
290      }
291      /**
292       * Retrieves the number of children in the BodyDecl list.
293       * @return Number of children in the BodyDecl list.
294       * @apilevel high-level
295       */
296      public int getNumBodyDecl() {
297        return getBodyDeclList().getNumChild();
298      }
299      /**
300       * Retrieves the number of children in the BodyDecl list.
301       * Calling this method will not trigger rewrites.
302       * @return Number of children in the BodyDecl list.
303       * @apilevel low-level
304       */
305      public int getNumBodyDeclNoTransform() {
306        return getBodyDeclListNoTransform().getNumChildNoTransform();
307      }
308      /**
309       * Retrieves the element at index {@code i} in the BodyDecl list.
310       * @param i Index of the element to return.
311       * @return The element at position {@code i} in the BodyDecl list.
312       * @apilevel high-level
313       */
314      public BodyDecl getBodyDecl(int i) {
315        return (BodyDecl) getBodyDeclList().getChild(i);
316      }
317      /**
318       * Check whether the BodyDecl list has any children.
319       * @return {@code true} if it has at least one child, {@code false} otherwise.
320       * @apilevel high-level
321       */
322      public boolean hasBodyDecl() {
323        return getBodyDeclList().getNumChild() != 0;
324      }
325      /**
326       * Append an element to the BodyDecl list.
327       * @param node The element to append to the BodyDecl list.
328       * @apilevel high-level
329       */
330      public void addBodyDecl(BodyDecl node) {
331        List<BodyDecl> list = (parent == null) ? getBodyDeclListNoTransform() : getBodyDeclList();
332        list.addChild(node);
333      }
334      /**
335       * @apilevel low-level
336       */
337      public void addBodyDeclNoTransform(BodyDecl node) {
338        List<BodyDecl> list = getBodyDeclListNoTransform();
339        list.addChild(node);
340      }
341      /**
342       * Replaces the BodyDecl list element at index {@code i} with the new node {@code node}.
343       * @param node The new node to replace the old list element.
344       * @param i The list index of the node to be replaced.
345       * @apilevel high-level
346       */
347      public void setBodyDecl(BodyDecl node, int i) {
348        List<BodyDecl> list = getBodyDeclList();
349        list.setChild(node, i);
350      }
351      /**
352       * Retrieves the BodyDecl list.
353       * @return The node representing the BodyDecl list.
354       * @apilevel high-level
355       */
356      @ASTNodeAnnotation.ListChild(name="BodyDecl")
357      public List<BodyDecl> getBodyDeclList() {
358        List<BodyDecl> list = (List<BodyDecl>) getChild(2);
359        return list;
360      }
361      /**
362       * Retrieves the BodyDecl list.
363       * <p><em>This method does not invoke AST transformations.</em></p>
364       * @return The node representing the BodyDecl list.
365       * @apilevel low-level
366       */
367      public List<BodyDecl> getBodyDeclListNoTransform() {
368        return (List<BodyDecl>) getChildNoTransform(2);
369      }
370      /**
371       * Retrieves the BodyDecl list.
372       * @return The node representing the BodyDecl list.
373       * @apilevel high-level
374       */
375      public List<BodyDecl> getBodyDecls() {
376        return getBodyDeclList();
377      }
378      /**
379       * Retrieves the BodyDecl list.
380       * <p><em>This method does not invoke AST transformations.</em></p>
381       * @return The node representing the BodyDecl list.
382       * @apilevel low-level
383       */
384      public List<BodyDecl> getBodyDeclsNoTransform() {
385        return getBodyDeclListNoTransform();
386      }
387      /**
388       * @apilevel internal
389       */
390      public ASTNode rewriteTo() {
391        return super.rewriteTo();
392      }
393    }