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 VoidType : {@link TypeDecl};
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:48
017     */
018    public class VoidType extends TypeDecl 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 VoidType clone() throws CloneNotSupportedException {
034        VoidType node = (VoidType)super.clone();
035        node.instanceOf_TypeDecl_values = null;
036        node.typeDescriptor_computed = false;
037        node.typeDescriptor_value = null;
038        node.subtype_TypeDecl_values = null;
039        node.fieldTypeSignature_computed = false;
040        node.fieldTypeSignature_value = null;
041        node.classTypeSignature_computed = false;
042        node.classTypeSignature_value = null;
043        node.in$Circle(false);
044        node.is$Final(false);
045        return node;
046      }
047    /**
048     * @apilevel internal
049     */
050      @SuppressWarnings({"unchecked", "cast"})
051    public VoidType copy() {
052      
053      try {
054        VoidType node = (VoidType) clone();
055        node.parent = null;
056        if(children != null)
057          node.children = (ASTNode[]) children.clone();
058        
059        return node;
060      } catch (CloneNotSupportedException e) {
061        throw new Error("Error: clone not supported for " + getClass().getName());
062      }
063      
064    }/**
065     * Create a deep copy of the AST subtree at this node.
066     * The copy is dangling, i.e. has no parent.
067     * @return dangling copy of the subtree at this node
068     * @apilevel low-level
069     */
070      @SuppressWarnings({"unchecked", "cast"})
071    public VoidType fullCopy() {
072      
073      VoidType tree = (VoidType) copy();
074      if (children != null) {
075        for (int i = 0; i < children.length; ++i) {
076          
077          ASTNode child = (ASTNode) children[i];
078          if(child != null) {
079            child = child.fullCopy();
080            tree.setChild(child, i);
081          }
082        }
083      }
084      return tree;
085      
086    }  /**
087       * @ast method 
088       * @aspect PrettyPrint
089       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:859
090       */
091      public void toString(StringBuffer s) {
092                s.append("void");
093        }
094      /**
095       * @ast method 
096       * @aspect CodeGeneration
097       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:613
098       */
099      public void emitReturn(CodeGeneration gen)      { gen.emit(Bytecode.RETURN);}
100      /**
101       * @ast method 
102       * @aspect CodeGeneration
103       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:845
104       */
105      public void emitDup(CodeGeneration gen)      { }
106      /**
107       * @ast method 
108       * @aspect CodeGeneration
109       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:850
110       */
111      public void emitDup_x1(CodeGeneration gen)   { }
112      /**
113       * @ast method 
114       * @aspect CodeGeneration
115       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:855
116       */
117      public void emitDup_x2(CodeGeneration gen)   { }
118      /**
119       * @ast method 
120       * @aspect CodeGeneration
121       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:860
122       */
123      public void emitPop(CodeGeneration gen)      { }
124      /**
125       * @ast method 
126       * 
127       */
128      public VoidType() {
129        super();
130    
131    
132      }
133      /**
134       * Initializes the child array to the correct size.
135       * Initializes List and Opt nta children.
136       * @apilevel internal
137       * @ast method
138       * @ast method 
139       * 
140       */
141      public void init$Children() {
142        children = new ASTNode[2];
143        setChild(new List(), 1);
144      }
145      /**
146       * @ast method 
147       * 
148       */
149      public VoidType(Modifiers p0, String p1, List<BodyDecl> p2) {
150        setChild(p0, 0);
151        setID(p1);
152        setChild(p2, 1);
153      }
154      /**
155       * @ast method 
156       * 
157       */
158      public VoidType(Modifiers p0, beaver.Symbol p1, List<BodyDecl> p2) {
159        setChild(p0, 0);
160        setID(p1);
161        setChild(p2, 1);
162      }
163      /**
164       * @apilevel low-level
165       * @ast method 
166       * 
167       */
168      protected int numChildren() {
169        return 2;
170      }
171      /**
172       * @apilevel internal
173       * @ast method 
174       * 
175       */
176      public boolean mayHaveRewrite() {
177        return false;
178      }
179      /**
180       * Replaces the Modifiers child.
181       * @param node The new node to replace the Modifiers child.
182       * @apilevel high-level
183       * @ast method 
184       * 
185       */
186      public void setModifiers(Modifiers node) {
187        setChild(node, 0);
188      }
189      /**
190       * Retrieves the Modifiers child.
191       * @return The current node used as the Modifiers child.
192       * @apilevel high-level
193       * @ast method 
194       * 
195       */
196      public Modifiers getModifiers() {
197        return (Modifiers)getChild(0);
198      }
199      /**
200       * Retrieves the Modifiers child.
201       * <p><em>This method does not invoke AST transformations.</em></p>
202       * @return The current node used as the Modifiers child.
203       * @apilevel low-level
204       * @ast method 
205       * 
206       */
207      public Modifiers getModifiersNoTransform() {
208        return (Modifiers)getChildNoTransform(0);
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 BodyDecl list.
245       * @param list The new list node to be used as the BodyDecl list.
246       * @apilevel high-level
247       * @ast method 
248       * 
249       */
250      public void setBodyDeclList(List<BodyDecl> list) {
251        setChild(list, 1);
252      }
253      /**
254       * Retrieves the number of children in the BodyDecl list.
255       * @return Number of children in the BodyDecl list.
256       * @apilevel high-level
257       * @ast method 
258       * 
259       */
260      public int getNumBodyDecl() {
261        return getBodyDeclList().getNumChild();
262      }
263      /**
264       * Retrieves the number of children in the BodyDecl list.
265       * Calling this method will not trigger rewrites..
266       * @return Number of children in the BodyDecl list.
267       * @apilevel low-level
268       * @ast method 
269       * 
270       */
271      public int getNumBodyDeclNoTransform() {
272        return getBodyDeclListNoTransform().getNumChildNoTransform();
273      }
274      /**
275       * Retrieves the element at index {@code i} in the BodyDecl list..
276       * @param i Index of the element to return.
277       * @return The element at position {@code i} in the BodyDecl list.
278       * @apilevel high-level
279       * @ast method 
280       * 
281       */
282      @SuppressWarnings({"unchecked", "cast"})
283      public BodyDecl getBodyDecl(int i) {
284        return (BodyDecl)getBodyDeclList().getChild(i);
285      }
286      /**
287       * Append an element to the BodyDecl list.
288       * @param node The element to append to the BodyDecl list.
289       * @apilevel high-level
290       * @ast method 
291       * 
292       */
293      public void addBodyDecl(BodyDecl node) {
294        List<BodyDecl> list = (parent == null || state == null) ? getBodyDeclListNoTransform() : getBodyDeclList();
295        list.addChild(node);
296      }
297      /**
298       * @apilevel low-level
299       * @ast method 
300       * 
301       */
302      public void addBodyDeclNoTransform(BodyDecl node) {
303        List<BodyDecl> list = getBodyDeclListNoTransform();
304        list.addChild(node);
305      }
306      /**
307       * Replaces the BodyDecl 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 setBodyDecl(BodyDecl node, int i) {
315        List<BodyDecl> list = getBodyDeclList();
316        list.setChild(node, i);
317      }
318      /**
319       * Retrieves the BodyDecl list.
320       * @return The node representing the BodyDecl list.
321       * @apilevel high-level
322       * @ast method 
323       * 
324       */
325      public List<BodyDecl> getBodyDecls() {
326        return getBodyDeclList();
327      }
328      /**
329       * Retrieves the BodyDecl list.
330       * <p><em>This method does not invoke AST transformations.</em></p>
331       * @return The node representing the BodyDecl list.
332       * @apilevel low-level
333       * @ast method 
334       * 
335       */
336      public List<BodyDecl> getBodyDeclsNoTransform() {
337        return getBodyDeclListNoTransform();
338      }
339      /**
340       * Retrieves the BodyDecl list.
341       * @return The node representing the BodyDecl list.
342       * @apilevel high-level
343       * @ast method 
344       * 
345       */
346      @SuppressWarnings({"unchecked", "cast"})
347      public List<BodyDecl> getBodyDeclList() {
348        List<BodyDecl> list = (List<BodyDecl>)getChild(1);
349        list.getNumChild();
350        return list;
351      }
352      /**
353       * Retrieves the BodyDecl list.
354       * <p><em>This method does not invoke AST transformations.</em></p>
355       * @return The node representing the BodyDecl list.
356       * @apilevel low-level
357       * @ast method 
358       * 
359       */
360      @SuppressWarnings({"unchecked", "cast"})
361      public List<BodyDecl> getBodyDeclListNoTransform() {
362        return (List<BodyDecl>)getChildNoTransform(1);
363      }
364      /**
365       * @attribute syn
366       * @aspect TypeConversion
367       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:55
368       */
369      public boolean stringConversion() {
370        ASTNode$State state = state();
371        try {  return false;  }
372        finally {
373        }
374      }
375      /**
376       * @attribute syn
377       * @aspect TypeAnalysis
378       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:202
379       */
380      public boolean isVoid() {
381        ASTNode$State state = state();
382        try {  return true;  }
383        finally {
384        }
385      }
386      protected java.util.Map instanceOf_TypeDecl_values;
387      /**
388       * @attribute syn
389       * @aspect GenericsSubtype
390       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:392
391       */
392      @SuppressWarnings({"unchecked", "cast"})
393      public boolean instanceOf(TypeDecl type) {
394        Object _parameters = type;
395        if(instanceOf_TypeDecl_values == null) instanceOf_TypeDecl_values = new java.util.HashMap(4);
396        if(instanceOf_TypeDecl_values.containsKey(_parameters)) {
397          return ((Boolean)instanceOf_TypeDecl_values.get(_parameters)).booleanValue();
398        }
399          ASTNode$State state = state();
400      int num = state.boundariesCrossed;
401      boolean isFinal = this.is$Final();
402        boolean instanceOf_TypeDecl_value = instanceOf_compute(type);
403      if(isFinal && num == state().boundariesCrossed){ instanceOf_TypeDecl_values.put(_parameters, Boolean.valueOf(instanceOf_TypeDecl_value)); }
404            return instanceOf_TypeDecl_value;
405      }
406      /**
407       * @apilevel internal
408       */
409      private boolean instanceOf_compute(TypeDecl type) { return subtype(type); }
410      /**
411       * @attribute syn
412       * @aspect TypeWideningAndIdentity
413       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:486
414       */
415      public boolean isSupertypeOfVoidType(VoidType type) {
416        ASTNode$State state = state();
417        try {  return true;  }
418        finally {
419        }
420      }
421      /**
422       * @apilevel internal
423       */
424      protected boolean typeDescriptor_computed = false;
425      /**
426       * @apilevel internal
427       */
428      protected String typeDescriptor_value;
429      /**
430       * @attribute syn
431       * @aspect ConstantPoolNames
432       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/ConstantPoolNames.jrag:25
433       */
434      @SuppressWarnings({"unchecked", "cast"})
435      public String typeDescriptor() {
436        if(typeDescriptor_computed) {
437          return typeDescriptor_value;
438        }
439          ASTNode$State state = state();
440      int num = state.boundariesCrossed;
441      boolean isFinal = this.is$Final();
442        typeDescriptor_value = typeDescriptor_compute();
443      if(isFinal && num == state().boundariesCrossed){ typeDescriptor_computed = true; }
444            return typeDescriptor_value;
445      }
446      /**
447       * @apilevel internal
448       */
449      private String typeDescriptor_compute() {  return "V";  }
450      /**
451       * @attribute syn
452       * @aspect Java2Rewrites
453       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/Java2Rewrites.jrag:44
454       */
455      public String primitiveClassName() {
456        ASTNode$State state = state();
457        try {  return "Void";  }
458        finally {
459        }
460      }
461      protected java.util.Map subtype_TypeDecl_values;
462      /**
463       * @attribute syn
464       * @aspect GenericsSubtype
465       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:412
466       */
467      @SuppressWarnings({"unchecked", "cast"})
468      public boolean subtype(TypeDecl type) {
469        Object _parameters = type;
470        if(subtype_TypeDecl_values == null) subtype_TypeDecl_values = new java.util.HashMap(4);
471        ASTNode$State.CircularValue _value;
472        if(subtype_TypeDecl_values.containsKey(_parameters)) {
473          Object _o = subtype_TypeDecl_values.get(_parameters);
474          if(!(_o instanceof ASTNode$State.CircularValue)) {
475            return ((Boolean)_o).booleanValue();
476          }
477          else
478            _value = (ASTNode$State.CircularValue)_o;
479        }
480        else {
481          _value = new ASTNode$State.CircularValue();
482          subtype_TypeDecl_values.put(_parameters, _value);
483          _value.value = Boolean.valueOf(true);
484        }
485        ASTNode$State state = state();
486        if (!state.IN_CIRCLE) {
487          state.IN_CIRCLE = true;
488          int num = state.boundariesCrossed;
489          boolean isFinal = this.is$Final();
490          boolean new_subtype_TypeDecl_value;
491          do {
492            _value.visited = new Integer(state.CIRCLE_INDEX);
493            state.CHANGE = false;
494            new_subtype_TypeDecl_value = subtype_compute(type);
495            if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) {
496              state.CHANGE = true;
497              _value.value = Boolean.valueOf(new_subtype_TypeDecl_value);
498            }
499            state.CIRCLE_INDEX++;
500          } while (state.CHANGE);
501            if(isFinal && num == state().boundariesCrossed) {
502            subtype_TypeDecl_values.put(_parameters, new_subtype_TypeDecl_value);
503          }
504          else {
505            subtype_TypeDecl_values.remove(_parameters);
506          state.RESET_CYCLE = true;
507          subtype_compute(type);
508          state.RESET_CYCLE = false;
509          }
510          state.IN_CIRCLE = false; 
511          return new_subtype_TypeDecl_value;
512        }
513        if(!new Integer(state.CIRCLE_INDEX).equals(_value.visited)) {
514          _value.visited = new Integer(state.CIRCLE_INDEX);
515          boolean new_subtype_TypeDecl_value = subtype_compute(type);
516          if (state.RESET_CYCLE) {
517            subtype_TypeDecl_values.remove(_parameters);
518          }
519          else if (new_subtype_TypeDecl_value!=((Boolean)_value.value).booleanValue()) {
520            state.CHANGE = true;
521            _value.value = new_subtype_TypeDecl_value;
522          }
523          return new_subtype_TypeDecl_value;
524        }
525        return ((Boolean)_value.value).booleanValue();
526      }
527      /**
528       * @apilevel internal
529       */
530      private boolean subtype_compute(TypeDecl type) {  return type.supertypeVoidType(this);  }
531      /**
532       * @attribute syn
533       * @aspect GenericsSubtype
534       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Frontend/GenericsSubtype.jrag:483
535       */
536      public boolean supertypeVoidType(VoidType type) {
537        ASTNode$State state = state();
538        try {  return true;  }
539        finally {
540        }
541      }
542      /**
543       * @apilevel internal
544       */
545      protected boolean fieldTypeSignature_computed = false;
546      /**
547       * @apilevel internal
548       */
549      protected String fieldTypeSignature_value;
550      /**
551       * @attribute syn
552       * @aspect GenericsCodegen
553       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:450
554       */
555      @SuppressWarnings({"unchecked", "cast"})
556      public String fieldTypeSignature() {
557        if(fieldTypeSignature_computed) {
558          return fieldTypeSignature_value;
559        }
560          ASTNode$State state = state();
561      int num = state.boundariesCrossed;
562      boolean isFinal = this.is$Final();
563        fieldTypeSignature_value = fieldTypeSignature_compute();
564      if(isFinal && num == state().boundariesCrossed){ fieldTypeSignature_computed = true; }
565            return fieldTypeSignature_value;
566      }
567      /**
568       * @apilevel internal
569       */
570      private String fieldTypeSignature_compute() {  return classTypeSignature();  }
571      /**
572       * @apilevel internal
573       */
574      protected boolean classTypeSignature_computed = false;
575      /**
576       * @apilevel internal
577       */
578      protected String classTypeSignature_value;
579      /**
580       * @attribute syn
581       * @aspect GenericsCodegen
582       * @declaredat /home/jesper/svn/JastAddJ/Java1.5Backend/GenericsCodegen.jrag:456
583       */
584      @SuppressWarnings({"unchecked", "cast"})
585      public String classTypeSignature() {
586        if(classTypeSignature_computed) {
587          return classTypeSignature_value;
588        }
589          ASTNode$State state = state();
590      int num = state.boundariesCrossed;
591      boolean isFinal = this.is$Final();
592        classTypeSignature_value = classTypeSignature_compute();
593      if(isFinal && num == state().boundariesCrossed){ classTypeSignature_computed = true; }
594            return classTypeSignature_value;
595      }
596      /**
597       * @apilevel internal
598       */
599      private String classTypeSignature_compute() {  return typeDescriptor();  }
600      /**
601       * @apilevel internal
602       */
603      public ASTNode rewriteTo() {
604        return super.rewriteTo();
605      }
606    }