001    /* This file was generated with JastAdd2 (http://jastadd.org) version R20130213 */
002    package AST;
003    
004    import java.util.HashSet;
005    import java.io.File;
006    import java.util.*;
007    import beaver.*;
008    import java.util.ArrayList;
009    import java.util.zip.*;
010    import java.io.*;
011    import java.io.FileNotFoundException;
012    import java.util.Collection;
013    /**
014     * @production RawConstructorDecl : {@link ParConstructorDecl};
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.ast:11
017     */
018    public class RawConstructorDecl extends ParConstructorDecl implements Cloneable {
019      /**
020       * @apilevel low-level
021       */
022      public void flushCache() {
023      }
024      /**
025       * @apilevel internal
026       */
027      public void flushCollectionCache() {
028      }
029      /**
030       * @apilevel internal
031       */
032      @SuppressWarnings({"unchecked", "cast"})
033      public RawConstructorDecl clone() throws CloneNotSupportedException {
034        RawConstructorDecl node = (RawConstructorDecl)super.clone();
035        node.in$Circle(false);
036        node.is$Final(false);
037        return node;
038      }
039    /**
040     * @apilevel internal
041     */
042      @SuppressWarnings({"unchecked", "cast"})
043    public RawConstructorDecl copy() {
044      
045      try {
046        RawConstructorDecl node = (RawConstructorDecl) clone();
047        node.parent = null;
048        if(children != null)
049          node.children = (ASTNode[]) children.clone();
050        
051        return node;
052      } catch (CloneNotSupportedException e) {
053        throw new Error("Error: clone not supported for " + getClass().getName());
054      }
055      
056    }/**
057     * Create a deep copy of the AST subtree at this node.
058     * The copy is dangling, i.e. has no parent.
059     * @return dangling copy of the subtree at this node
060     * @apilevel low-level
061     */
062      @SuppressWarnings({"unchecked", "cast"})
063    public RawConstructorDecl fullCopy() {
064      
065      RawConstructorDecl tree = (RawConstructorDecl) copy();
066      if (children != null) {
067        for (int i = 0; i < children.length; ++i) {
068          
069          ASTNode child = (ASTNode) children[i];
070          if(child != null) {
071            child = child.fullCopy();
072            tree.setChild(child, i);
073          }
074        }
075      }
076      return tree;
077      
078    }  /**
079       * @ast method 
080       * 
081       */
082      public RawConstructorDecl() {
083        super();
084    
085    
086      }
087      /**
088       * Initializes the child array to the correct size.
089       * Initializes List and Opt nta children.
090       * @apilevel internal
091       * @ast method
092       * @ast method 
093       * 
094       */
095      public void init$Children() {
096        children = new ASTNode[6];
097        setChild(new List(), 1);
098        setChild(new List(), 2);
099        setChild(new Opt(), 3);
100        setChild(new List(), 5);
101      }
102      /**
103       * @ast method 
104       * 
105       */
106      public RawConstructorDecl(Modifiers p0, String p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<Access> p6) {
107        setChild(p0, 0);
108        setID(p1);
109        setChild(p2, 1);
110        setChild(p3, 2);
111        setChild(p4, 3);
112        setChild(p5, 4);
113        setChild(p6, 5);
114      }
115      /**
116       * @ast method 
117       * 
118       */
119      public RawConstructorDecl(Modifiers p0, beaver.Symbol p1, List<ParameterDeclaration> p2, List<Access> p3, Opt<Stmt> p4, Block p5, List<Access> p6) {
120        setChild(p0, 0);
121        setID(p1);
122        setChild(p2, 1);
123        setChild(p3, 2);
124        setChild(p4, 3);
125        setChild(p5, 4);
126        setChild(p6, 5);
127      }
128      /**
129       * @apilevel low-level
130       * @ast method 
131       * 
132       */
133      protected int numChildren() {
134        return 6;
135      }
136      /**
137       * @apilevel internal
138       * @ast method 
139       * 
140       */
141      public boolean mayHaveRewrite() {
142        return true;
143      }
144      /**
145       * Replaces the Modifiers child.
146       * @param node The new node to replace the Modifiers child.
147       * @apilevel high-level
148       * @ast method 
149       * 
150       */
151      public void setModifiers(Modifiers node) {
152        setChild(node, 0);
153      }
154      /**
155       * Retrieves the Modifiers child.
156       * @return The current node used as the Modifiers child.
157       * @apilevel high-level
158       * @ast method 
159       * 
160       */
161      public Modifiers getModifiers() {
162        return (Modifiers)getChild(0);
163      }
164      /**
165       * Retrieves the Modifiers child.
166       * <p><em>This method does not invoke AST transformations.</em></p>
167       * @return The current node used as the Modifiers child.
168       * @apilevel low-level
169       * @ast method 
170       * 
171       */
172      public Modifiers getModifiersNoTransform() {
173        return (Modifiers)getChildNoTransform(0);
174      }
175      /**
176       * Replaces the lexeme ID.
177       * @param value The new value for the lexeme ID.
178       * @apilevel high-level
179       * @ast method 
180       * 
181       */
182      public void setID(String value) {
183        tokenString_ID = value;
184      }
185      /**
186       * JastAdd-internal setter for lexeme ID using the Beaver parser.
187       * @apilevel internal
188       * @ast method 
189       * 
190       */
191      public void setID(beaver.Symbol symbol) {
192        if(symbol.value != null && !(symbol.value instanceof String))
193          throw new UnsupportedOperationException("setID is only valid for String lexemes");
194        tokenString_ID = (String)symbol.value;
195        IDstart = symbol.getStart();
196        IDend = symbol.getEnd();
197      }
198      /**
199       * Retrieves the value for the lexeme ID.
200       * @return The value for the lexeme ID.
201       * @apilevel high-level
202       * @ast method 
203       * 
204       */
205      public String getID() {
206        return tokenString_ID != null ? tokenString_ID : "";
207      }
208      /**
209       * Replaces the Parameter list.
210       * @param list The new list node to be used as the Parameter list.
211       * @apilevel high-level
212       * @ast method 
213       * 
214       */
215      public void setParameterList(List<ParameterDeclaration> list) {
216        setChild(list, 1);
217      }
218      /**
219       * Retrieves the number of children in the Parameter list.
220       * @return Number of children in the Parameter list.
221       * @apilevel high-level
222       * @ast method 
223       * 
224       */
225      public int getNumParameter() {
226        return getParameterList().getNumChild();
227      }
228      /**
229       * Retrieves the number of children in the Parameter list.
230       * Calling this method will not trigger rewrites..
231       * @return Number of children in the Parameter list.
232       * @apilevel low-level
233       * @ast method 
234       * 
235       */
236      public int getNumParameterNoTransform() {
237        return getParameterListNoTransform().getNumChildNoTransform();
238      }
239      /**
240       * Retrieves the element at index {@code i} in the Parameter list..
241       * @param i Index of the element to return.
242       * @return The element at position {@code i} in the Parameter list.
243       * @apilevel high-level
244       * @ast method 
245       * 
246       */
247      @SuppressWarnings({"unchecked", "cast"})
248      public ParameterDeclaration getParameter(int i) {
249        return (ParameterDeclaration)getParameterList().getChild(i);
250      }
251      /**
252       * Append an element to the Parameter list.
253       * @param node The element to append to the Parameter list.
254       * @apilevel high-level
255       * @ast method 
256       * 
257       */
258      public void addParameter(ParameterDeclaration node) {
259        List<ParameterDeclaration> list = (parent == null || state == null) ? getParameterListNoTransform() : getParameterList();
260        list.addChild(node);
261      }
262      /**
263       * @apilevel low-level
264       * @ast method 
265       * 
266       */
267      public void addParameterNoTransform(ParameterDeclaration node) {
268        List<ParameterDeclaration> list = getParameterListNoTransform();
269        list.addChild(node);
270      }
271      /**
272       * Replaces the Parameter list element at index {@code i} with the new node {@code node}.
273       * @param node The new node to replace the old list element.
274       * @param i The list index of the node to be replaced.
275       * @apilevel high-level
276       * @ast method 
277       * 
278       */
279      public void setParameter(ParameterDeclaration node, int i) {
280        List<ParameterDeclaration> list = getParameterList();
281        list.setChild(node, i);
282      }
283      /**
284       * Retrieves the Parameter list.
285       * @return The node representing the Parameter list.
286       * @apilevel high-level
287       * @ast method 
288       * 
289       */
290      public List<ParameterDeclaration> getParameters() {
291        return getParameterList();
292      }
293      /**
294       * Retrieves the Parameter list.
295       * <p><em>This method does not invoke AST transformations.</em></p>
296       * @return The node representing the Parameter list.
297       * @apilevel low-level
298       * @ast method 
299       * 
300       */
301      public List<ParameterDeclaration> getParametersNoTransform() {
302        return getParameterListNoTransform();
303      }
304      /**
305       * Retrieves the Parameter list.
306       * @return The node representing the Parameter list.
307       * @apilevel high-level
308       * @ast method 
309       * 
310       */
311      @SuppressWarnings({"unchecked", "cast"})
312      public List<ParameterDeclaration> getParameterList() {
313        List<ParameterDeclaration> list = (List<ParameterDeclaration>)getChild(1);
314        list.getNumChild();
315        return list;
316      }
317      /**
318       * Retrieves the Parameter list.
319       * <p><em>This method does not invoke AST transformations.</em></p>
320       * @return The node representing the Parameter list.
321       * @apilevel low-level
322       * @ast method 
323       * 
324       */
325      @SuppressWarnings({"unchecked", "cast"})
326      public List<ParameterDeclaration> getParameterListNoTransform() {
327        return (List<ParameterDeclaration>)getChildNoTransform(1);
328      }
329      /**
330       * Replaces the Exception list.
331       * @param list The new list node to be used as the Exception list.
332       * @apilevel high-level
333       * @ast method 
334       * 
335       */
336      public void setExceptionList(List<Access> list) {
337        setChild(list, 2);
338      }
339      /**
340       * Retrieves the number of children in the Exception list.
341       * @return Number of children in the Exception list.
342       * @apilevel high-level
343       * @ast method 
344       * 
345       */
346      public int getNumException() {
347        return getExceptionList().getNumChild();
348      }
349      /**
350       * Retrieves the number of children in the Exception list.
351       * Calling this method will not trigger rewrites..
352       * @return Number of children in the Exception list.
353       * @apilevel low-level
354       * @ast method 
355       * 
356       */
357      public int getNumExceptionNoTransform() {
358        return getExceptionListNoTransform().getNumChildNoTransform();
359      }
360      /**
361       * Retrieves the element at index {@code i} in the Exception list..
362       * @param i Index of the element to return.
363       * @return The element at position {@code i} in the Exception list.
364       * @apilevel high-level
365       * @ast method 
366       * 
367       */
368      @SuppressWarnings({"unchecked", "cast"})
369      public Access getException(int i) {
370        return (Access)getExceptionList().getChild(i);
371      }
372      /**
373       * Append an element to the Exception list.
374       * @param node The element to append to the Exception list.
375       * @apilevel high-level
376       * @ast method 
377       * 
378       */
379      public void addException(Access node) {
380        List<Access> list = (parent == null || state == null) ? getExceptionListNoTransform() : getExceptionList();
381        list.addChild(node);
382      }
383      /**
384       * @apilevel low-level
385       * @ast method 
386       * 
387       */
388      public void addExceptionNoTransform(Access node) {
389        List<Access> list = getExceptionListNoTransform();
390        list.addChild(node);
391      }
392      /**
393       * Replaces the Exception list element at index {@code i} with the new node {@code node}.
394       * @param node The new node to replace the old list element.
395       * @param i The list index of the node to be replaced.
396       * @apilevel high-level
397       * @ast method 
398       * 
399       */
400      public void setException(Access node, int i) {
401        List<Access> list = getExceptionList();
402        list.setChild(node, i);
403      }
404      /**
405       * Retrieves the Exception list.
406       * @return The node representing the Exception list.
407       * @apilevel high-level
408       * @ast method 
409       * 
410       */
411      public List<Access> getExceptions() {
412        return getExceptionList();
413      }
414      /**
415       * Retrieves the Exception list.
416       * <p><em>This method does not invoke AST transformations.</em></p>
417       * @return The node representing the Exception list.
418       * @apilevel low-level
419       * @ast method 
420       * 
421       */
422      public List<Access> getExceptionsNoTransform() {
423        return getExceptionListNoTransform();
424      }
425      /**
426       * Retrieves the Exception list.
427       * @return The node representing the Exception list.
428       * @apilevel high-level
429       * @ast method 
430       * 
431       */
432      @SuppressWarnings({"unchecked", "cast"})
433      public List<Access> getExceptionList() {
434        List<Access> list = (List<Access>)getChild(2);
435        list.getNumChild();
436        return list;
437      }
438      /**
439       * Retrieves the Exception list.
440       * <p><em>This method does not invoke AST transformations.</em></p>
441       * @return The node representing the Exception list.
442       * @apilevel low-level
443       * @ast method 
444       * 
445       */
446      @SuppressWarnings({"unchecked", "cast"})
447      public List<Access> getExceptionListNoTransform() {
448        return (List<Access>)getChildNoTransform(2);
449      }
450      /**
451       * Replaces the optional node for the ConstructorInvocation child. This is the {@code Opt} node containing the child ConstructorInvocation, not the actual child!
452       * @param opt The new node to be used as the optional node for the ConstructorInvocation child.
453       * @apilevel low-level
454       * @ast method 
455       * 
456       */
457      public void setConstructorInvocationOpt(Opt<Stmt> opt) {
458        setChild(opt, 3);
459      }
460      /**
461       * Check whether the optional ConstructorInvocation child exists.
462       * @return {@code true} if the optional ConstructorInvocation child exists, {@code false} if it does not.
463       * @apilevel high-level
464       * @ast method 
465       * 
466       */
467      public boolean hasConstructorInvocation() {
468        return getConstructorInvocationOpt().getNumChild() != 0;
469      }
470      /**
471       * Retrieves the (optional) ConstructorInvocation child.
472       * @return The ConstructorInvocation child, if it exists. Returns {@code null} otherwise.
473       * @apilevel low-level
474       * @ast method 
475       * 
476       */
477      @SuppressWarnings({"unchecked", "cast"})
478      public Stmt getConstructorInvocation() {
479        return (Stmt)getConstructorInvocationOpt().getChild(0);
480      }
481      /**
482       * Replaces the (optional) ConstructorInvocation child.
483       * @param node The new node to be used as the ConstructorInvocation child.
484       * @apilevel high-level
485       * @ast method 
486       * 
487       */
488      public void setConstructorInvocation(Stmt node) {
489        getConstructorInvocationOpt().setChild(node, 0);
490      }
491      /**
492       * @apilevel low-level
493       * @ast method 
494       * 
495       */
496      @SuppressWarnings({"unchecked", "cast"})
497      public Opt<Stmt> getConstructorInvocationOpt() {
498        return (Opt<Stmt>)getChild(3);
499      }
500      /**
501       * Retrieves the optional node for child ConstructorInvocation. This is the {@code Opt} node containing the child ConstructorInvocation, not the actual child!
502       * <p><em>This method does not invoke AST transformations.</em></p>
503       * @return The optional node for child ConstructorInvocation.
504       * @apilevel low-level
505       * @ast method 
506       * 
507       */
508      @SuppressWarnings({"unchecked", "cast"})
509      public Opt<Stmt> getConstructorInvocationOptNoTransform() {
510        return (Opt<Stmt>)getChildNoTransform(3);
511      }
512      /**
513       * Replaces the Block child.
514       * @param node The new node to replace the Block child.
515       * @apilevel high-level
516       * @ast method 
517       * 
518       */
519      public void setBlock(Block node) {
520        setChild(node, 4);
521      }
522      /**
523       * Retrieves the Block child.
524       * @return The current node used as the Block child.
525       * @apilevel high-level
526       * @ast method 
527       * 
528       */
529      public Block getBlock() {
530        return (Block)getChild(4);
531      }
532      /**
533       * Retrieves the Block child.
534       * <p><em>This method does not invoke AST transformations.</em></p>
535       * @return The current node used as the Block child.
536       * @apilevel low-level
537       * @ast method 
538       * 
539       */
540      public Block getBlockNoTransform() {
541        return (Block)getChildNoTransform(4);
542      }
543      /**
544       * Replaces the TypeArgument list.
545       * @param list The new list node to be used as the TypeArgument list.
546       * @apilevel high-level
547       * @ast method 
548       * 
549       */
550      public void setTypeArgumentList(List<Access> list) {
551        setChild(list, 5);
552      }
553      /**
554       * Retrieves the number of children in the TypeArgument list.
555       * @return Number of children in the TypeArgument list.
556       * @apilevel high-level
557       * @ast method 
558       * 
559       */
560      public int getNumTypeArgument() {
561        return getTypeArgumentList().getNumChild();
562      }
563      /**
564       * Retrieves the number of children in the TypeArgument list.
565       * Calling this method will not trigger rewrites..
566       * @return Number of children in the TypeArgument list.
567       * @apilevel low-level
568       * @ast method 
569       * 
570       */
571      public int getNumTypeArgumentNoTransform() {
572        return getTypeArgumentListNoTransform().getNumChildNoTransform();
573      }
574      /**
575       * Retrieves the element at index {@code i} in the TypeArgument list..
576       * @param i Index of the element to return.
577       * @return The element at position {@code i} in the TypeArgument list.
578       * @apilevel high-level
579       * @ast method 
580       * 
581       */
582      @SuppressWarnings({"unchecked", "cast"})
583      public Access getTypeArgument(int i) {
584        return (Access)getTypeArgumentList().getChild(i);
585      }
586      /**
587       * Append an element to the TypeArgument list.
588       * @param node The element to append to the TypeArgument list.
589       * @apilevel high-level
590       * @ast method 
591       * 
592       */
593      public void addTypeArgument(Access node) {
594        List<Access> list = (parent == null || state == null) ? getTypeArgumentListNoTransform() : getTypeArgumentList();
595        list.addChild(node);
596      }
597      /**
598       * @apilevel low-level
599       * @ast method 
600       * 
601       */
602      public void addTypeArgumentNoTransform(Access node) {
603        List<Access> list = getTypeArgumentListNoTransform();
604        list.addChild(node);
605      }
606      /**
607       * Replaces the TypeArgument list element at index {@code i} with the new node {@code node}.
608       * @param node The new node to replace the old list element.
609       * @param i The list index of the node to be replaced.
610       * @apilevel high-level
611       * @ast method 
612       * 
613       */
614      public void setTypeArgument(Access node, int i) {
615        List<Access> list = getTypeArgumentList();
616        list.setChild(node, i);
617      }
618      /**
619       * Retrieves the TypeArgument list.
620       * @return The node representing the TypeArgument list.
621       * @apilevel high-level
622       * @ast method 
623       * 
624       */
625      public List<Access> getTypeArguments() {
626        return getTypeArgumentList();
627      }
628      /**
629       * Retrieves the TypeArgument list.
630       * <p><em>This method does not invoke AST transformations.</em></p>
631       * @return The node representing the TypeArgument list.
632       * @apilevel low-level
633       * @ast method 
634       * 
635       */
636      public List<Access> getTypeArgumentsNoTransform() {
637        return getTypeArgumentListNoTransform();
638      }
639      /**
640       * Retrieves the TypeArgument list.
641       * @return The node representing the TypeArgument list.
642       * @apilevel high-level
643       * @ast method 
644       * 
645       */
646      @SuppressWarnings({"unchecked", "cast"})
647      public List<Access> getTypeArgumentList() {
648        List<Access> list = (List<Access>)getChild(5);
649        list.getNumChild();
650        return list;
651      }
652      /**
653       * Retrieves the TypeArgument list.
654       * <p><em>This method does not invoke AST transformations.</em></p>
655       * @return The node representing the TypeArgument list.
656       * @apilevel low-level
657       * @ast method 
658       * 
659       */
660      @SuppressWarnings({"unchecked", "cast"})
661      public List<Access> getTypeArgumentListNoTransform() {
662        return (List<Access>)getChildNoTransform(5);
663      }
664      /**
665       * @apilevel internal
666       */
667      public ASTNode rewriteTo() {
668        return super.rewriteTo();
669      }
670    }