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 LogicalExpr : {@link Binary};
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:171
017     */
018    public abstract class LogicalExpr extends Binary 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 LogicalExpr clone() throws CloneNotSupportedException {
034        LogicalExpr node = (LogicalExpr)super.clone();
035        node.type_computed = false;
036        node.type_value = null;
037        node.in$Circle(false);
038        node.is$Final(false);
039        return node;
040      }
041      /**
042       * @ast method 
043       * @aspect TypeCheck
044       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeCheck.jrag:212
045       */
046      public void typeCheck() {
047        if(!getLeftOperand().type().isBoolean())
048          error(getLeftOperand().type().typeName() + " is not boolean");
049        if(!getRightOperand().type().isBoolean())
050          error(getRightOperand().type().typeName() + " is not boolean");
051      }
052      /**
053       * @ast method 
054       * @aspect CreateBCode
055       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1029
056       */
057      public void createBCode(CodeGeneration gen) { emitBooleanCondition(gen); }
058      /**
059       * @ast method 
060       * 
061       */
062      public LogicalExpr() {
063        super();
064    
065    
066      }
067      /**
068       * Initializes the child array to the correct size.
069       * Initializes List and Opt nta children.
070       * @apilevel internal
071       * @ast method
072       * @ast method 
073       * 
074       */
075      public void init$Children() {
076        children = new ASTNode[2];
077      }
078      /**
079       * @ast method 
080       * 
081       */
082      public LogicalExpr(Expr p0, Expr p1) {
083        setChild(p0, 0);
084        setChild(p1, 1);
085      }
086      /**
087       * @apilevel low-level
088       * @ast method 
089       * 
090       */
091      protected int numChildren() {
092        return 2;
093      }
094      /**
095       * @apilevel internal
096       * @ast method 
097       * 
098       */
099      public boolean mayHaveRewrite() {
100        return false;
101      }
102      /**
103       * Replaces the LeftOperand child.
104       * @param node The new node to replace the LeftOperand child.
105       * @apilevel high-level
106       * @ast method 
107       * 
108       */
109      public void setLeftOperand(Expr node) {
110        setChild(node, 0);
111      }
112      /**
113       * Retrieves the LeftOperand child.
114       * @return The current node used as the LeftOperand child.
115       * @apilevel high-level
116       * @ast method 
117       * 
118       */
119      public Expr getLeftOperand() {
120        return (Expr)getChild(0);
121      }
122      /**
123       * Retrieves the LeftOperand child.
124       * <p><em>This method does not invoke AST transformations.</em></p>
125       * @return The current node used as the LeftOperand child.
126       * @apilevel low-level
127       * @ast method 
128       * 
129       */
130      public Expr getLeftOperandNoTransform() {
131        return (Expr)getChildNoTransform(0);
132      }
133      /**
134       * Replaces the RightOperand child.
135       * @param node The new node to replace the RightOperand child.
136       * @apilevel high-level
137       * @ast method 
138       * 
139       */
140      public void setRightOperand(Expr node) {
141        setChild(node, 1);
142      }
143      /**
144       * Retrieves the RightOperand child.
145       * @return The current node used as the RightOperand child.
146       * @apilevel high-level
147       * @ast method 
148       * 
149       */
150      public Expr getRightOperand() {
151        return (Expr)getChild(1);
152      }
153      /**
154       * Retrieves the RightOperand child.
155       * <p><em>This method does not invoke AST transformations.</em></p>
156       * @return The current node used as the RightOperand child.
157       * @apilevel low-level
158       * @ast method 
159       * 
160       */
161      public Expr getRightOperandNoTransform() {
162        return (Expr)getChildNoTransform(1);
163      }
164      /**
165       * @apilevel internal
166       */
167      protected boolean type_computed = false;
168      /**
169       * @apilevel internal
170       */
171      protected TypeDecl type_value;
172      /**
173       * @attribute syn
174       * @aspect TypeAnalysis
175       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:347
176       */
177      @SuppressWarnings({"unchecked", "cast"})
178      public TypeDecl type() {
179        if(type_computed) {
180          return type_value;
181        }
182          ASTNode$State state = state();
183      int num = state.boundariesCrossed;
184      boolean isFinal = this.is$Final();
185        type_value = type_compute();
186      if(isFinal && num == state().boundariesCrossed){ type_computed = true; }
187            return type_value;
188      }
189      /**
190       * @apilevel internal
191       */
192      private TypeDecl type_compute() {  return typeBoolean();  }
193      /**
194       * @attribute syn
195       * @aspect CreateBCode
196       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:946
197       */
198      public boolean definesLabel() {
199        ASTNode$State state = state();
200        try {  return true;  }
201        finally {
202        }
203      }
204      /**
205       * @apilevel internal
206       */
207      public ASTNode rewriteTo() {
208        return super.rewriteTo();
209      }
210    }