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