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