⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modexpr.java

📁 JDK1.4编译器前端
💻 JAVA
字号:

package AST;
import java.util.HashSet;import java.util.LinkedHashSet;import java.io.FileNotFoundException;import java.io.File;import java.util.*;import beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;public class ModExpr extends MultiplicativeExpr implements Cloneable {
    public void flushCache() {        super.flushCache();        constant_visited = -1;        isConstant_visited = 0;        isConstant_computed = false;        isConstant_initialized = false;        printOp_visited = -1;    }     @SuppressWarnings({"unchecked", "cast"})  public ModExpr clone() throws CloneNotSupportedException {        ModExpr node = (ModExpr)super.clone();        node.constant_visited = -1;        node.isConstant_visited = 0;        node.isConstant_computed = false;        node.isConstant_initialized = false;        node.printOp_visited = -1;        node.in$Circle(false);        node.is$Final(false);    return node;    }     @SuppressWarnings({"unchecked", "cast"})  public ModExpr copy() {      try {          ModExpr node = (ModExpr)clone();          if(children != null) node.children = (ASTNode[])children.clone();          return node;      } catch (CloneNotSupportedException e) {      }      System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");      return null;    }     @SuppressWarnings({"unchecked", "cast"})  public ModExpr fullCopy() {        ModExpr res = (ModExpr)copy();        for(int i = 0; i < getNumChildNoTransform(); i++) {          ASTNode node = getChildNoTransform(i);          if(node != null) node = node.fullCopy();          res.setChild(node, i);        }        return res;    }    // Declared in java.ast at line 3    // Declared in java.ast line 159
    public ModExpr() {        super();

    }    // Declared in java.ast at line 10
    // Declared in java.ast line 159    public ModExpr(Expr p0, Expr p1) {        setChild(p0, 0);        setChild(p1, 1);    }    // Declared in java.ast at line 15  protected int numChildren() {
    return 2;
  }    // Declared in java.ast at line 18
  public boolean mayHaveRewrite() { return false; }    // Declared in java.ast at line 2    // Declared in java.ast line 153    public void setLeftOperand(Expr node) {        setChild(node, 0);    }    // Declared in java.ast at line 5    public Expr getLeftOperand() {        return (Expr)getChild(0);    }    // Declared in java.ast at line 9    public Expr getLeftOperandNoTransform() {        return (Expr)getChildNoTransform(0);    }    // Declared in java.ast at line 2    // Declared in java.ast line 153    public void setRightOperand(Expr node) {        setChild(node, 1);    }    // Declared in java.ast at line 5    public Expr getRightOperand() {        return (Expr)getChild(1);    }    // Declared in java.ast at line 9    public Expr getRightOperandNoTransform() {        return (Expr)getChildNoTransform(1);    }    protected int constant_visited = -1;    // Declared in ConstantExpression.jrag at line 119 @SuppressWarnings({"unchecked", "cast"})     public Constant constant() {        if(constant_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: constant in class: ");        constant_visited = boundariesCrossed;        Constant constant_value = constant_compute();        constant_visited = -1;        return constant_value;    }    private Constant constant_compute() {  return type().mod(getLeftOperand().constant(), getRightOperand().constant());  }    protected int isConstant_visited;    protected boolean isConstant_computed = false;    protected boolean isConstant_initialized = false;    protected boolean isConstant_value; @SuppressWarnings({"unchecked", "cast"})     public boolean isConstant() {        if(isConstant_computed)            return isConstant_value;        if (!isConstant_initialized) {            isConstant_initialized = true;            isConstant_value = false;        }        if (!IN_CIRCLE) {            IN_CIRCLE = true;            int num = boundariesCrossed;        boolean isFinal = this.is$Final();            CIRCLE_INDEX = 1;            do {                isConstant_visited = CIRCLE_INDEX;                CHANGE = false;        if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree");                boolean new_isConstant_value = isConstant_compute();                if (new_isConstant_value!=isConstant_value)                    CHANGE = true;                isConstant_value = new_isConstant_value;                 CIRCLE_INDEX++;if(CIRCLE_INDEX > 100) throw new java.lang.RuntimeException("Iteration limit 100 exceeded");            } while (CHANGE);            if(isFinal && num == boundariesCrossed){            isConstant_computed = true;            LAST_CYCLE = true;        if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree");            isConstant_compute();            LAST_CYCLE = false;            }            else {            RESET_CYCLE = true;        if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree");            isConstant_compute();            RESET_CYCLE = false;              isConstant_computed = false;              isConstant_initialized = false;            }            IN_CIRCLE = false;             return isConstant_value;        }        if(isConstant_visited != CIRCLE_INDEX) {            isConstant_visited = CIRCLE_INDEX;            if (LAST_CYCLE) {                isConstant_computed = true;        if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree");                return isConstant_compute();            }            if (RESET_CYCLE) {                isConstant_computed = false;                isConstant_initialized = false;                return isConstant_value;            }        if(getParent() == null) throw new RuntimeException("Trying to evaluate attribute in subtree not attached to main tree");            boolean new_isConstant_value = isConstant_compute();            if (new_isConstant_value!=isConstant_value)                CHANGE = true;            isConstant_value = new_isConstant_value;             return isConstant_value;        }        return isConstant_value;    }    private boolean isConstant_compute() {  return getLeftOperand().isConstant() && getRightOperand().isConstant() && !(getRightOperand().type().isInt() && getRightOperand().constant().intValue() == 0);  }    protected int printOp_visited = -1;    // Declared in PrettyPrint.jadd at line 419 @SuppressWarnings({"unchecked", "cast"})     public String printOp() {        if(printOp_visited == boundariesCrossed)            throw new RuntimeException("Circular definition of attr: printOp in class: ");        printOp_visited = boundariesCrossed;        String printOp_value = printOp_compute();        printOp_visited = -1;        return printOp_value;    }    private String printOp_compute() {  return " % ";  }public ASTNode rewriteTo() {    return super.rewriteTo();}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -