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 BridgeMethodDecl : {@link MethodDecl};
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/Generics.ast:51
017     */
018    public class BridgeMethodDecl extends MethodDecl 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 BridgeMethodDecl clone() throws CloneNotSupportedException {
034        BridgeMethodDecl node = (BridgeMethodDecl)super.clone();
035        node.flags_computed = false;
036        node.in$Circle(false);
037        node.is$Final(false);
038        return node;
039      }
040    /**
041     * @apilevel internal
042     */
043      @SuppressWarnings({"unchecked", "cast"})
044    public BridgeMethodDecl copy() {
045      
046      try {
047        BridgeMethodDecl node = (BridgeMethodDecl) clone();
048        node.parent = null;
049        if(children != null)
050          node.children = (ASTNode[]) children.clone();
051        
052        return node;
053      } catch (CloneNotSupportedException e) {
054        throw new Error("Error: clone not supported for " + getClass().getName());
055      }
056      
057    }/**
058     * Create a deep copy of the AST subtree at this node.
059     * The copy is dangling, i.e. has no parent.
060     * @return dangling copy of the subtree at this node
061     * @apilevel low-level
062     */
063      @SuppressWarnings({"unchecked", "cast"})
064    public BridgeMethodDecl fullCopy() {
065      
066      BridgeMethodDecl tree = (BridgeMethodDecl) copy();
067      if (children != null) {
068        for (int i = 0; i < children.length; ++i) {
069          
070          ASTNode child = (ASTNode) children[i];
071          if(child != null) {
072            child = child.fullCopy();
073            tree.setChild(child, i);
074          }
075        }
076      }
077      return tree;
078      
079    }  /**
080       * @ast method 
081       * @aspect GenericsCodegen
082       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:214
083       */
084      public void transformation() { }
085      /**
086       * @ast method 
087       * 
088       */
089      public BridgeMethodDecl() {
090        super();
091    
092    
093      }
094      /**
095       * Initializes the child array to the correct size.
096       * Initializes List and Opt nta children.
097       * @apilevel internal
098       * @ast method
099       * @ast method 
100       * 
101       */
102      public void init$Children() {
103        children = new ASTNode[5];
104        setChild(new List(), 2);
105        setChild(new List(), 3);
106        setChild(new Opt(), 4);
107      }
108      /**
109       * @ast method 
110       * 
111       */
112      public BridgeMethodDecl(Modifiers p0, Access p1, String p2, List<ParameterDeclaration> p3, List<Access> p4, Opt<Block> p5) {
113        setChild(p0, 0);
114        setChild(p1, 1);
115        setID(p2);
116        setChild(p3, 2);
117        setChild(p4, 3);
118        setChild(p5, 4);
119      }
120      /**
121       * @ast method 
122       * 
123       */
124      public BridgeMethodDecl(Modifiers p0, Access p1, beaver.Symbol p2, List<ParameterDeclaration> p3, List<Access> p4, Opt<Block> p5) {
125        setChild(p0, 0);
126        setChild(p1, 1);
127        setID(p2);
128        setChild(p3, 2);
129        setChild(p4, 3);
130        setChild(p5, 4);
131      }
132      /**
133       * @apilevel low-level
134       * @ast method 
135       * 
136       */
137      protected int numChildren() {
138        return 5;
139      }
140      /**
141       * @apilevel internal
142       * @ast method 
143       * 
144       */
145      public boolean mayHaveRewrite() {
146        return false;
147      }
148      /**
149       * Replaces the Modifiers child.
150       * @param node The new node to replace the Modifiers child.
151       * @apilevel high-level
152       * @ast method 
153       * 
154       */
155      public void setModifiers(Modifiers node) {
156        setChild(node, 0);
157      }
158      /**
159       * Retrieves the Modifiers child.
160       * @return The current node used as the Modifiers child.
161       * @apilevel high-level
162       * @ast method 
163       * 
164       */
165      public Modifiers getModifiers() {
166        return (Modifiers)getChild(0);
167      }
168      /**
169       * Retrieves the Modifiers child.
170       * <p><em>This method does not invoke AST transformations.</em></p>
171       * @return The current node used as the Modifiers child.
172       * @apilevel low-level
173       * @ast method 
174       * 
175       */
176      public Modifiers getModifiersNoTransform() {
177        return (Modifiers)getChildNoTransform(0);
178      }
179      /**
180       * Replaces the TypeAccess child.
181       * @param node The new node to replace the TypeAccess child.
182       * @apilevel high-level
183       * @ast method 
184       * 
185       */
186      public void setTypeAccess(Access node) {
187        setChild(node, 1);
188      }
189      /**
190       * Retrieves the TypeAccess child.
191       * @return The current node used as the TypeAccess child.
192       * @apilevel high-level
193       * @ast method 
194       * 
195       */
196      public Access getTypeAccess() {
197        return (Access)getChild(1);
198      }
199      /**
200       * Retrieves the TypeAccess child.
201       * <p><em>This method does not invoke AST transformations.</em></p>
202       * @return The current node used as the TypeAccess child.
203       * @apilevel low-level
204       * @ast method 
205       * 
206       */
207      public Access getTypeAccessNoTransform() {
208        return (Access)getChildNoTransform(1);
209      }
210      /**
211       * Replaces the lexeme ID.
212       * @param value The new value for the lexeme ID.
213       * @apilevel high-level
214       * @ast method 
215       * 
216       */
217      public void setID(String value) {
218        tokenString_ID = value;
219      }
220      /**
221       * JastAdd-internal setter for lexeme ID using the Beaver parser.
222       * @apilevel internal
223       * @ast method 
224       * 
225       */
226      public void setID(beaver.Symbol symbol) {
227        if(symbol.value != null && !(symbol.value instanceof String))
228          throw new UnsupportedOperationException("setID is only valid for String lexemes");
229        tokenString_ID = (String)symbol.value;
230        IDstart = symbol.getStart();
231        IDend = symbol.getEnd();
232      }
233      /**
234       * Retrieves the value for the lexeme ID.
235       * @return The value for the lexeme ID.
236       * @apilevel high-level
237       * @ast method 
238       * 
239       */
240      public String getID() {
241        return tokenString_ID != null ? tokenString_ID : "";
242      }
243      /**
244       * Replaces the Parameter list.
245       * @param list The new list node to be used as the Parameter list.
246       * @apilevel high-level
247       * @ast method 
248       * 
249       */
250      public void setParameterList(List<ParameterDeclaration> list) {
251        setChild(list, 2);
252      }
253      /**
254       * Retrieves the number of children in the Parameter list.
255       * @return Number of children in the Parameter list.
256       * @apilevel high-level
257       * @ast method 
258       * 
259       */
260      public int getNumParameter() {
261        return getParameterList().getNumChild();
262      }
263      /**
264       * Retrieves the number of children in the Parameter list.
265       * Calling this method will not trigger rewrites..
266       * @return Number of children in the Parameter list.
267       * @apilevel low-level
268       * @ast method 
269       * 
270       */
271      public int getNumParameterNoTransform() {
272        return getParameterListNoTransform().getNumChildNoTransform();
273      }
274      /**
275       * Retrieves the element at index {@code i} in the Parameter list..
276       * @param i Index of the element to return.
277       * @return The element at position {@code i} in the Parameter list.
278       * @apilevel high-level
279       * @ast method 
280       * 
281       */
282      @SuppressWarnings({"unchecked", "cast"})
283      public ParameterDeclaration getParameter(int i) {
284        return (ParameterDeclaration)getParameterList().getChild(i);
285      }
286      /**
287       * Append an element to the Parameter list.
288       * @param node The element to append to the Parameter list.
289       * @apilevel high-level
290       * @ast method 
291       * 
292       */
293      public void addParameter(ParameterDeclaration node) {
294        List<ParameterDeclaration> list = (parent == null || state == null) ? getParameterListNoTransform() : getParameterList();
295        list.addChild(node);
296      }
297      /**
298       * @apilevel low-level
299       * @ast method 
300       * 
301       */
302      public void addParameterNoTransform(ParameterDeclaration node) {
303        List<ParameterDeclaration> list = getParameterListNoTransform();
304        list.addChild(node);
305      }
306      /**
307       * Replaces the Parameter list element at index {@code i} with the new node {@code node}.
308       * @param node The new node to replace the old list element.
309       * @param i The list index of the node to be replaced.
310       * @apilevel high-level
311       * @ast method 
312       * 
313       */
314      public void setParameter(ParameterDeclaration node, int i) {
315        List<ParameterDeclaration> list = getParameterList();
316        list.setChild(node, i);
317      }
318      /**
319       * Retrieves the Parameter list.
320       * @return The node representing the Parameter list.
321       * @apilevel high-level
322       * @ast method 
323       * 
324       */
325      public List<ParameterDeclaration> getParameters() {
326        return getParameterList();
327      }
328      /**
329       * Retrieves the Parameter list.
330       * <p><em>This method does not invoke AST transformations.</em></p>
331       * @return The node representing the Parameter list.
332       * @apilevel low-level
333       * @ast method 
334       * 
335       */
336      public List<ParameterDeclaration> getParametersNoTransform() {
337        return getParameterListNoTransform();
338      }
339      /**
340       * Retrieves the Parameter list.
341       * @return The node representing the Parameter list.
342       * @apilevel high-level
343       * @ast method 
344       * 
345       */
346      @SuppressWarnings({"unchecked", "cast"})
347      public List<ParameterDeclaration> getParameterList() {
348        List<ParameterDeclaration> list = (List<ParameterDeclaration>)getChild(2);
349        list.getNumChild();
350        return list;
351      }
352      /**
353       * Retrieves the Parameter list.
354       * <p><em>This method does not invoke AST transformations.</em></p>
355       * @return The node representing the Parameter list.
356       * @apilevel low-level
357       * @ast method 
358       * 
359       */
360      @SuppressWarnings({"unchecked", "cast"})
361      public List<ParameterDeclaration> getParameterListNoTransform() {
362        return (List<ParameterDeclaration>)getChildNoTransform(2);
363      }
364      /**
365       * Replaces the Exception list.
366       * @param list The new list node to be used as the Exception list.
367       * @apilevel high-level
368       * @ast method 
369       * 
370       */
371      public void setExceptionList(List<Access> list) {
372        setChild(list, 3);
373      }
374      /**
375       * Retrieves the number of children in the Exception list.
376       * @return Number of children in the Exception list.
377       * @apilevel high-level
378       * @ast method 
379       * 
380       */
381      public int getNumException() {
382        return getExceptionList().getNumChild();
383      }
384      /**
385       * Retrieves the number of children in the Exception list.
386       * Calling this method will not trigger rewrites..
387       * @return Number of children in the Exception list.
388       * @apilevel low-level
389       * @ast method 
390       * 
391       */
392      public int getNumExceptionNoTransform() {
393        return getExceptionListNoTransform().getNumChildNoTransform();
394      }
395      /**
396       * Retrieves the element at index {@code i} in the Exception list..
397       * @param i Index of the element to return.
398       * @return The element at position {@code i} in the Exception list.
399       * @apilevel high-level
400       * @ast method 
401       * 
402       */
403      @SuppressWarnings({"unchecked", "cast"})
404      public Access getException(int i) {
405        return (Access)getExceptionList().getChild(i);
406      }
407      /**
408       * Append an element to the Exception list.
409       * @param node The element to append to the Exception list.
410       * @apilevel high-level
411       * @ast method 
412       * 
413       */
414      public void addException(Access node) {
415        List<Access> list = (parent == null || state == null) ? getExceptionListNoTransform() : getExceptionList();
416        list.addChild(node);
417      }
418      /**
419       * @apilevel low-level
420       * @ast method 
421       * 
422       */
423      public void addExceptionNoTransform(Access node) {
424        List<Access> list = getExceptionListNoTransform();
425        list.addChild(node);
426      }
427      /**
428       * Replaces the Exception list element at index {@code i} with the new node {@code node}.
429       * @param node The new node to replace the old list element.
430       * @param i The list index of the node to be replaced.
431       * @apilevel high-level
432       * @ast method 
433       * 
434       */
435      public void setException(Access node, int i) {
436        List<Access> list = getExceptionList();
437        list.setChild(node, i);
438      }
439      /**
440       * Retrieves the Exception list.
441       * @return The node representing the Exception list.
442       * @apilevel high-level
443       * @ast method 
444       * 
445       */
446      public List<Access> getExceptions() {
447        return getExceptionList();
448      }
449      /**
450       * Retrieves the Exception list.
451       * <p><em>This method does not invoke AST transformations.</em></p>
452       * @return The node representing the Exception list.
453       * @apilevel low-level
454       * @ast method 
455       * 
456       */
457      public List<Access> getExceptionsNoTransform() {
458        return getExceptionListNoTransform();
459      }
460      /**
461       * Retrieves the Exception list.
462       * @return The node representing the Exception list.
463       * @apilevel high-level
464       * @ast method 
465       * 
466       */
467      @SuppressWarnings({"unchecked", "cast"})
468      public List<Access> getExceptionList() {
469        List<Access> list = (List<Access>)getChild(3);
470        list.getNumChild();
471        return list;
472      }
473      /**
474       * Retrieves the Exception list.
475       * <p><em>This method does not invoke AST transformations.</em></p>
476       * @return The node representing the Exception list.
477       * @apilevel low-level
478       * @ast method 
479       * 
480       */
481      @SuppressWarnings({"unchecked", "cast"})
482      public List<Access> getExceptionListNoTransform() {
483        return (List<Access>)getChildNoTransform(3);
484      }
485      /**
486       * Replaces the optional node for the Block child. This is the {@code Opt} node containing the child Block, not the actual child!
487       * @param opt The new node to be used as the optional node for the Block child.
488       * @apilevel low-level
489       * @ast method 
490       * 
491       */
492      public void setBlockOpt(Opt<Block> opt) {
493        setChild(opt, 4);
494      }
495      /**
496       * Check whether the optional Block child exists.
497       * @return {@code true} if the optional Block child exists, {@code false} if it does not.
498       * @apilevel high-level
499       * @ast method 
500       * 
501       */
502      public boolean hasBlock() {
503        return getBlockOpt().getNumChild() != 0;
504      }
505      /**
506       * Retrieves the (optional) Block child.
507       * @return The Block child, if it exists. Returns {@code null} otherwise.
508       * @apilevel low-level
509       * @ast method 
510       * 
511       */
512      @SuppressWarnings({"unchecked", "cast"})
513      public Block getBlock() {
514        return (Block)getBlockOpt().getChild(0);
515      }
516      /**
517       * Replaces the (optional) Block child.
518       * @param node The new node to be used as the Block child.
519       * @apilevel high-level
520       * @ast method 
521       * 
522       */
523      public void setBlock(Block node) {
524        getBlockOpt().setChild(node, 0);
525      }
526      /**
527       * @apilevel low-level
528       * @ast method 
529       * 
530       */
531      @SuppressWarnings({"unchecked", "cast"})
532      public Opt<Block> getBlockOpt() {
533        return (Opt<Block>)getChild(4);
534      }
535      /**
536       * Retrieves the optional node for child Block. This is the {@code Opt} node containing the child Block, not the actual child!
537       * <p><em>This method does not invoke AST transformations.</em></p>
538       * @return The optional node for child Block.
539       * @apilevel low-level
540       * @ast method 
541       * 
542       */
543      @SuppressWarnings({"unchecked", "cast"})
544      public Opt<Block> getBlockOptNoTransform() {
545        return (Opt<Block>)getChildNoTransform(4);
546      }
547      /**
548       * @apilevel internal
549       */
550      protected boolean flags_computed = false;
551      /**
552       * @apilevel internal
553       */
554      protected int flags_value;
555      /**
556       * @attribute syn
557       * @aspect GenericsCodegen
558       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:220
559       */
560      @SuppressWarnings({"unchecked", "cast"})
561      public int flags() {
562        if(flags_computed) {
563          return flags_value;
564        }
565          ASTNode$State state = state();
566      int num = state.boundariesCrossed;
567      boolean isFinal = this.is$Final();
568        flags_value = flags_compute();
569      if(isFinal && num == state().boundariesCrossed){ flags_computed = true; }
570            return flags_value;
571      }
572      /**
573       * @apilevel internal
574       */
575      private int flags_compute() {
576        int res = super.flags();
577        res |= Modifiers.ACC_BRIDGE;
578        res |= Modifiers.ACC_SYNTHETIC;
579        return res;
580      }
581      /**
582       * @apilevel internal
583       */
584      public ASTNode rewriteTo() {
585        return super.rewriteTo();
586      }
587    }