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 LogNotExpr : {@link Unary};
015     * @ast node
016     * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/java.ast:142
017     */
018    public class LogNotExpr extends Unary 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 LogNotExpr clone() throws CloneNotSupportedException {
034        LogNotExpr node = (LogNotExpr)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     * @apilevel internal
043     */
044      @SuppressWarnings({"unchecked", "cast"})
045    public LogNotExpr copy() {
046      
047      try {
048        LogNotExpr node = (LogNotExpr) clone();
049        node.parent = null;
050        if(children != null)
051          node.children = (ASTNode[]) children.clone();
052        
053        return node;
054      } catch (CloneNotSupportedException e) {
055        throw new Error("Error: clone not supported for " + getClass().getName());
056      }
057      
058    }/**
059     * Create a deep copy of the AST subtree at this node.
060     * The copy is dangling, i.e. has no parent.
061     * @return dangling copy of the subtree at this node
062     * @apilevel low-level
063     */
064      @SuppressWarnings({"unchecked", "cast"})
065    public LogNotExpr fullCopy() {
066      
067      LogNotExpr tree = (LogNotExpr) copy();
068      if (children != null) {
069        for (int i = 0; i < children.length; ++i) {
070          
071          ASTNode child = (ASTNode) children[i];
072          if(child != null) {
073            child = child.fullCopy();
074            tree.setChild(child, i);
075          }
076        }
077      }
078      return tree;
079      
080    }  /**
081       * @ast method 
082       * @aspect TypeCheck
083       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeCheck.jrag:287
084       */
085      public void typeCheck() {
086        if(!getOperand().type().isBoolean())
087          error("unary ! only operates on boolean types");
088      }
089      /**
090       * @ast method 
091       * @aspect CodeGenerationBinaryOperations
092       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CodeGeneration.jrag:1021
093       */
094      void emitOperation(CodeGeneration gen) { type().logNot(gen); }
095      /**
096       * @ast method 
097       * @aspect CreateBCode
098       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1028
099       */
100      public void createBCode(CodeGeneration gen) { emitBooleanCondition(gen); }
101      /**
102       * @ast method 
103       * @aspect CreateBCode
104       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1084
105       */
106      public void emitEvalBranch(CodeGeneration gen)  { getOperand().emitEvalBranch(gen); }
107      /**
108       * @ast method 
109       * 
110       */
111      public LogNotExpr() {
112        super();
113    
114    
115      }
116      /**
117       * Initializes the child array to the correct size.
118       * Initializes List and Opt nta children.
119       * @apilevel internal
120       * @ast method
121       * @ast method 
122       * 
123       */
124      public void init$Children() {
125        children = new ASTNode[1];
126      }
127      /**
128       * @ast method 
129       * 
130       */
131      public LogNotExpr(Expr p0) {
132        setChild(p0, 0);
133      }
134      /**
135       * @apilevel low-level
136       * @ast method 
137       * 
138       */
139      protected int numChildren() {
140        return 1;
141      }
142      /**
143       * @apilevel internal
144       * @ast method 
145       * 
146       */
147      public boolean mayHaveRewrite() {
148        return false;
149      }
150      /**
151       * Replaces the Operand child.
152       * @param node The new node to replace the Operand child.
153       * @apilevel high-level
154       * @ast method 
155       * 
156       */
157      public void setOperand(Expr node) {
158        setChild(node, 0);
159      }
160      /**
161       * Retrieves the Operand child.
162       * @return The current node used as the Operand child.
163       * @apilevel high-level
164       * @ast method 
165       * 
166       */
167      public Expr getOperand() {
168        return (Expr)getChild(0);
169      }
170      /**
171       * Retrieves the Operand child.
172       * <p><em>This method does not invoke AST transformations.</em></p>
173       * @return The current node used as the Operand child.
174       * @apilevel low-level
175       * @ast method 
176       * 
177       */
178      public Expr getOperandNoTransform() {
179        return (Expr)getChildNoTransform(0);
180      }
181      /**
182       * @attribute syn
183       * @aspect ConstantExpression
184       * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:336
185       */
186      public boolean isConstant() {
187        ASTNode$State state = state();
188        try {  return getOperand().isConstant();  }
189        finally {
190        }
191      }
192      /**
193       * @attribute syn
194       * @aspect ConstantExpression
195       * @declaredat /home/jesper/svn/JastAddJ/Java7Frontend/ConstantExpression.jrag:91
196       */
197      public Constant constant() {
198        ASTNode$State state = state();
199        try {  return Constant.create(!getOperand().constant().booleanValue());  }
200        finally {
201        }
202      }
203      /*eq Stmt.isDAafter(Variable v) {
204        //System.out.println("### isDAafter reached in " + getClass().getName());
205        //throw new NullPointerException();
206        throw new Error("Can not compute isDAafter for " + getClass().getName() + " at " + errorPrefix());
207      }* @attribute syn
208       * @aspect DA
209       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:332
210       */
211      public boolean isDAafterTrue(Variable v) {
212        ASTNode$State state = state();
213        try {  return getOperand().isDAafterFalse(v) || isFalse();  }
214        finally {
215        }
216      }
217      /**
218       * @attribute syn
219       * @aspect DA
220       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:333
221       */
222      public boolean isDAafterFalse(Variable v) {
223        ASTNode$State state = state();
224        try {  return getOperand().isDAafterTrue(v) || isTrue();  }
225        finally {
226        }
227      }
228      /**
229       * @attribute syn
230       * @aspect DA
231       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:235
232       */
233      public boolean isDAafter(Variable v) {
234        ASTNode$State state = state();
235        try {  return isDAafterTrue(v) && isDAafterFalse(v);  }
236        finally {
237        }
238      }
239      /**
240       * @attribute syn
241       * @aspect DU
242       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:702
243       */
244      public boolean isDUafterTrue(Variable v) {
245        ASTNode$State state = state();
246        try {  return getOperand().isDUafterFalse(v);  }
247        finally {
248        }
249      }
250      /**
251       * @attribute syn
252       * @aspect DU
253       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:703
254       */
255      public boolean isDUafterFalse(Variable v) {
256        ASTNode$State state = state();
257        try {  return getOperand().isDUafterTrue(v);  }
258        finally {
259        }
260      }
261      /**
262       * @attribute syn
263       * @aspect DU
264       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:694
265       */
266      public boolean isDUafter(Variable v) {
267        ASTNode$State state = state();
268        try {  return isDUafterTrue(v) && isDUafterFalse(v);  }
269        finally {
270        }
271      }
272      /**
273       * @attribute syn
274       * @aspect PrettyPrint
275       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/PrettyPrint.jadd:376
276       */
277      public String printPreOp() {
278        ASTNode$State state = state();
279        try {  return "!";  }
280        finally {
281        }
282      }
283      /**
284       * @apilevel internal
285       */
286      protected boolean type_computed = false;
287      /**
288       * @apilevel internal
289       */
290      protected TypeDecl type_value;
291      /**
292       * @attribute syn
293       * @aspect TypeAnalysis
294       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/TypeAnalysis.jrag:318
295       */
296      @SuppressWarnings({"unchecked", "cast"})
297      public TypeDecl type() {
298        if(type_computed) {
299          return type_value;
300        }
301          ASTNode$State state = state();
302      int num = state.boundariesCrossed;
303      boolean isFinal = this.is$Final();
304        type_value = type_compute();
305      if(isFinal && num == state().boundariesCrossed){ type_computed = true; }
306            return type_value;
307      }
308      /**
309       * @apilevel internal
310       */
311      private TypeDecl type_compute() {  return typeBoolean();  }
312      /**
313       * @attribute syn
314       * @aspect CreateBCode
315       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:946
316       */
317      public boolean definesLabel() {
318        ASTNode$State state = state();
319        try {  return true;  }
320        finally {
321        }
322      }
323      /**
324       * @attribute syn
325       * @aspect CreateBCode
326       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1007
327       */
328      public boolean canBeTrue() {
329        ASTNode$State state = state();
330        try {  return getOperand().canBeFalse();  }
331        finally {
332        }
333      }
334      /**
335       * @attribute syn
336       * @aspect CreateBCode
337       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:1017
338       */
339      public boolean canBeFalse() {
340        ASTNode$State state = state();
341        try {  return getOperand().canBeTrue();  }
342        finally {
343        }
344      }
345      /**
346       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:380
347       * @apilevel internal
348       */
349      public boolean Define_boolean_isDAbefore(ASTNode caller, ASTNode child, Variable v) {
350        if(caller == getOperandNoTransform()) {
351          return isDAbefore(v);
352        }
353        else {      return getParent().Define_boolean_isDAbefore(this, caller, v);
354        }
355      }
356      /**
357       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Frontend/DefiniteAssignment.jrag:816
358       * @apilevel internal
359       */
360      public boolean Define_boolean_isDUbefore(ASTNode caller, ASTNode child, Variable v) {
361        if(caller == getOperandNoTransform()) {
362          return isDUbefore(v);
363        }
364        else {      return getParent().Define_boolean_isDUbefore(this, caller, v);
365        }
366      }
367      /**
368       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:982
369       * @apilevel internal
370       */
371      public int Define_int_condition_false_label(ASTNode caller, ASTNode child) {
372        if(caller == getOperandNoTransform()) {
373          return true_label();
374        }
375        else {      return getParent().Define_int_condition_false_label(this, caller);
376        }
377      }
378      /**
379       * @declaredat /home/jesper/svn/JastAddJ/Java1.4Backend/CreateBCode.jrag:983
380       * @apilevel internal
381       */
382      public int Define_int_condition_true_label(ASTNode caller, ASTNode child) {
383        if(caller == getOperandNoTransform()) {
384          return false_label();
385        }
386        else {      return getParent().Define_int_condition_true_label(this, caller);
387        }
388      }
389      /**
390       * @apilevel internal
391       */
392      public ASTNode rewriteTo() {
393        return super.rewriteTo();
394      }
395    }