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 ParSuperConstructorAccess : {@link SuperConstructorAccess} ::= <span class="component">TypeArgument:{@link Access}*</span>;
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.ast:17
017     */
018    public class ParSuperConstructorAccess extends SuperConstructorAccess 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 ParSuperConstructorAccess clone() throws CloneNotSupportedException {
034        ParSuperConstructorAccess node = (ParSuperConstructorAccess)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 ParSuperConstructorAccess copy() {
044      
045      try {
046        ParSuperConstructorAccess node = (ParSuperConstructorAccess) 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 ParSuperConstructorAccess fullCopy() {
064      
065      ParSuperConstructorAccess tree = (ParSuperConstructorAccess) 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       * @aspect GenericMethodsPrettyPrint
081       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.jrag:197
082       */
083      public void toString(StringBuffer s) {
084        s.append("<");
085        for(int i = 0; i < getNumTypeArgument(); i++) {
086          if(i != 0) s.append(", ");
087          getTypeArgument(i).toString(s);
088        }
089        s.append(">");
090        super.toString(s);
091      }
092      /**
093       * @ast method 
094       * 
095       */
096      public ParSuperConstructorAccess() {
097        super();
098    
099    
100      }
101      /**
102       * Initializes the child array to the correct size.
103       * Initializes List and Opt nta children.
104       * @apilevel internal
105       * @ast method
106       * @ast method 
107       * 
108       */
109      public void init$Children() {
110        children = new ASTNode[2];
111        setChild(new List(), 0);
112        setChild(new List(), 1);
113      }
114      /**
115       * @ast method 
116       * 
117       */
118      public ParSuperConstructorAccess(String p0, List<Expr> p1, List<Access> p2) {
119        setID(p0);
120        setChild(p1, 0);
121        setChild(p2, 1);
122      }
123      /**
124       * @ast method 
125       * 
126       */
127      public ParSuperConstructorAccess(beaver.Symbol p0, List<Expr> p1, List<Access> p2) {
128        setID(p0);
129        setChild(p1, 0);
130        setChild(p2, 1);
131      }
132      /**
133       * @apilevel low-level
134       * @ast method 
135       * 
136       */
137      protected int numChildren() {
138        return 2;
139      }
140      /**
141       * @apilevel internal
142       * @ast method 
143       * 
144       */
145      public boolean mayHaveRewrite() {
146        return false;
147      }
148      /**
149       * Replaces the lexeme ID.
150       * @param value The new value for the lexeme ID.
151       * @apilevel high-level
152       * @ast method 
153       * 
154       */
155      public void setID(String value) {
156        tokenString_ID = value;
157      }
158      /**
159       * JastAdd-internal setter for lexeme ID using the Beaver parser.
160       * @apilevel internal
161       * @ast method 
162       * 
163       */
164      public void setID(beaver.Symbol symbol) {
165        if(symbol.value != null && !(symbol.value instanceof String))
166          throw new UnsupportedOperationException("setID is only valid for String lexemes");
167        tokenString_ID = (String)symbol.value;
168        IDstart = symbol.getStart();
169        IDend = symbol.getEnd();
170      }
171      /**
172       * Retrieves the value for the lexeme ID.
173       * @return The value for the lexeme ID.
174       * @apilevel high-level
175       * @ast method 
176       * 
177       */
178      public String getID() {
179        return tokenString_ID != null ? tokenString_ID : "";
180      }
181      /**
182       * Replaces the Arg list.
183       * @param list The new list node to be used as the Arg list.
184       * @apilevel high-level
185       * @ast method 
186       * 
187       */
188      public void setArgList(List<Expr> list) {
189        setChild(list, 0);
190      }
191      /**
192       * Retrieves the number of children in the Arg list.
193       * @return Number of children in the Arg list.
194       * @apilevel high-level
195       * @ast method 
196       * 
197       */
198      public int getNumArg() {
199        return getArgList().getNumChild();
200      }
201      /**
202       * Retrieves the number of children in the Arg list.
203       * Calling this method will not trigger rewrites..
204       * @return Number of children in the Arg list.
205       * @apilevel low-level
206       * @ast method 
207       * 
208       */
209      public int getNumArgNoTransform() {
210        return getArgListNoTransform().getNumChildNoTransform();
211      }
212      /**
213       * Retrieves the element at index {@code i} in the Arg list..
214       * @param i Index of the element to return.
215       * @return The element at position {@code i} in the Arg list.
216       * @apilevel high-level
217       * @ast method 
218       * 
219       */
220      @SuppressWarnings({"unchecked", "cast"})
221      public Expr getArg(int i) {
222        return (Expr)getArgList().getChild(i);
223      }
224      /**
225       * Append an element to the Arg list.
226       * @param node The element to append to the Arg list.
227       * @apilevel high-level
228       * @ast method 
229       * 
230       */
231      public void addArg(Expr node) {
232        List<Expr> list = (parent == null || state == null) ? getArgListNoTransform() : getArgList();
233        list.addChild(node);
234      }
235      /**
236       * @apilevel low-level
237       * @ast method 
238       * 
239       */
240      public void addArgNoTransform(Expr node) {
241        List<Expr> list = getArgListNoTransform();
242        list.addChild(node);
243      }
244      /**
245       * Replaces the Arg list element at index {@code i} with the new node {@code node}.
246       * @param node The new node to replace the old list element.
247       * @param i The list index of the node to be replaced.
248       * @apilevel high-level
249       * @ast method 
250       * 
251       */
252      public void setArg(Expr node, int i) {
253        List<Expr> list = getArgList();
254        list.setChild(node, i);
255      }
256      /**
257       * Retrieves the Arg list.
258       * @return The node representing the Arg list.
259       * @apilevel high-level
260       * @ast method 
261       * 
262       */
263      public List<Expr> getArgs() {
264        return getArgList();
265      }
266      /**
267       * Retrieves the Arg list.
268       * <p><em>This method does not invoke AST transformations.</em></p>
269       * @return The node representing the Arg list.
270       * @apilevel low-level
271       * @ast method 
272       * 
273       */
274      public List<Expr> getArgsNoTransform() {
275        return getArgListNoTransform();
276      }
277      /**
278       * Retrieves the Arg list.
279       * @return The node representing the Arg list.
280       * @apilevel high-level
281       * @ast method 
282       * 
283       */
284      @SuppressWarnings({"unchecked", "cast"})
285      public List<Expr> getArgList() {
286        List<Expr> list = (List<Expr>)getChild(0);
287        list.getNumChild();
288        return list;
289      }
290      /**
291       * Retrieves the Arg list.
292       * <p><em>This method does not invoke AST transformations.</em></p>
293       * @return The node representing the Arg list.
294       * @apilevel low-level
295       * @ast method 
296       * 
297       */
298      @SuppressWarnings({"unchecked", "cast"})
299      public List<Expr> getArgListNoTransform() {
300        return (List<Expr>)getChildNoTransform(0);
301      }
302      /**
303       * Replaces the TypeArgument list.
304       * @param list The new list node to be used as the TypeArgument list.
305       * @apilevel high-level
306       * @ast method 
307       * 
308       */
309      public void setTypeArgumentList(List<Access> list) {
310        setChild(list, 1);
311      }
312      /**
313       * Retrieves the number of children in the TypeArgument list.
314       * @return Number of children in the TypeArgument list.
315       * @apilevel high-level
316       * @ast method 
317       * 
318       */
319      public int getNumTypeArgument() {
320        return getTypeArgumentList().getNumChild();
321      }
322      /**
323       * Retrieves the number of children in the TypeArgument list.
324       * Calling this method will not trigger rewrites..
325       * @return Number of children in the TypeArgument list.
326       * @apilevel low-level
327       * @ast method 
328       * 
329       */
330      public int getNumTypeArgumentNoTransform() {
331        return getTypeArgumentListNoTransform().getNumChildNoTransform();
332      }
333      /**
334       * Retrieves the element at index {@code i} in the TypeArgument list..
335       * @param i Index of the element to return.
336       * @return The element at position {@code i} in the TypeArgument list.
337       * @apilevel high-level
338       * @ast method 
339       * 
340       */
341      @SuppressWarnings({"unchecked", "cast"})
342      public Access getTypeArgument(int i) {
343        return (Access)getTypeArgumentList().getChild(i);
344      }
345      /**
346       * Append an element to the TypeArgument list.
347       * @param node The element to append to the TypeArgument list.
348       * @apilevel high-level
349       * @ast method 
350       * 
351       */
352      public void addTypeArgument(Access node) {
353        List<Access> list = (parent == null || state == null) ? getTypeArgumentListNoTransform() : getTypeArgumentList();
354        list.addChild(node);
355      }
356      /**
357       * @apilevel low-level
358       * @ast method 
359       * 
360       */
361      public void addTypeArgumentNoTransform(Access node) {
362        List<Access> list = getTypeArgumentListNoTransform();
363        list.addChild(node);
364      }
365      /**
366       * Replaces the TypeArgument list element at index {@code i} with the new node {@code node}.
367       * @param node The new node to replace the old list element.
368       * @param i The list index of the node to be replaced.
369       * @apilevel high-level
370       * @ast method 
371       * 
372       */
373      public void setTypeArgument(Access node, int i) {
374        List<Access> list = getTypeArgumentList();
375        list.setChild(node, i);
376      }
377      /**
378       * Retrieves the TypeArgument list.
379       * @return The node representing the TypeArgument list.
380       * @apilevel high-level
381       * @ast method 
382       * 
383       */
384      public List<Access> getTypeArguments() {
385        return getTypeArgumentList();
386      }
387      /**
388       * Retrieves the TypeArgument list.
389       * <p><em>This method does not invoke AST transformations.</em></p>
390       * @return The node representing the TypeArgument list.
391       * @apilevel low-level
392       * @ast method 
393       * 
394       */
395      public List<Access> getTypeArgumentsNoTransform() {
396        return getTypeArgumentListNoTransform();
397      }
398      /**
399       * Retrieves the TypeArgument list.
400       * @return The node representing the TypeArgument list.
401       * @apilevel high-level
402       * @ast method 
403       * 
404       */
405      @SuppressWarnings({"unchecked", "cast"})
406      public List<Access> getTypeArgumentList() {
407        List<Access> list = (List<Access>)getChild(1);
408        list.getNumChild();
409        return list;
410      }
411      /**
412       * Retrieves the TypeArgument list.
413       * <p><em>This method does not invoke AST transformations.</em></p>
414       * @return The node representing the TypeArgument list.
415       * @apilevel low-level
416       * @ast method 
417       * 
418       */
419      @SuppressWarnings({"unchecked", "cast"})
420      public List<Access> getTypeArgumentListNoTransform() {
421        return (List<Access>)getChildNoTransform(1);
422      }
423      /**
424       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.jrag:158
425       * @apilevel internal
426       */
427      public NameType Define_NameType_nameType(ASTNode caller, ASTNode child) {
428        if(caller == getTypeArgumentListNoTransform())  {
429        int childIndex = caller.getIndexOfChild(child);
430        return NameType.TYPE_NAME;
431      }
432        else {      return super.Define_NameType_nameType(caller, child);
433        }
434      }
435      /**
436       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericMethods.jrag:159
437       * @apilevel internal
438       */
439      public SimpleSet Define_SimpleSet_lookupType(ASTNode caller, ASTNode child, String name) {
440        if(caller == getTypeArgumentListNoTransform())  {
441        int childIndex = caller.getIndexOfChild(child);
442        return unqualifiedScope().lookupType(name);
443      }
444        else {      return super.Define_SimpleSet_lookupType(caller, child, name);
445        }
446      }
447      /**
448       * @apilevel internal
449       */
450      public ASTNode rewriteTo() {
451        return super.rewriteTo();
452      }
453    }