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