@Override
    public void endVisit(InfixExpression node) {
      if (node.getOperator() == InfixExpression.Operator.CONDITIONAL_AND
          || node.getOperator() == InfixExpression.Operator.CONDITIONAL_OR) {
        boolean isAnd = node.getOperator() == InfixExpression.Operator.CONDITIONAL_AND;
        boolean isSame = true;
        BooleanConstantLE diffVal = isAnd ? BooleanConstantLE.FALSE : BooleanConstantLE.TRUE;
        BooleanConstantLE sameVal = isAnd ? BooleanConstantLE.TRUE : BooleanConstantLE.FALSE;

        List<Expression> operands = new LinkedList<Expression>();

        operands.add(node.getLeftOperand());
        operands.add(node.getRightOperand());
        operands.addAll(node.extendedOperands());

        for (Expression exp : operands) {
          BooleanConstantLE val = fa.getResultsAfter(exp).get(fa.getVariable(exp));

          if (val == diffVal)
            reporter.reportUserProblem(
                "The expression " + node + " will always be " + !isAnd + ".", node, getName());
          isSame = isSame && val == sameVal;
        }

        if (isSame)
          reporter.reportUserProblem(
              "The expression " + node + " will always be " + isAnd + ".", node, getName());
      }
    }
 /**
  * 为约束表达式建立约束
  *
  * @param exp
  * @return
  */
 public Constraint constraintModeling(InfixExpression exp) {
   Constraint constraint = null;
   exp.getOperator();
   exp.getLeftOperand();
   exp.getRightOperand();
   return constraint;
 }
 /*
  * @see ASTVisitor#visit(InfixExpression)
  */
 public boolean visit(InfixExpression node) {
   node.getLeftOperand().accept(this);
   this.fBuffer.append(' '); // for cases like x= i - -1; or x= i++ + ++i;
   this.fBuffer.append(node.getOperator().toString());
   this.fBuffer.append(' ');
   node.getRightOperand().accept(this);
   final List extendedOperands = node.extendedOperands();
   if (extendedOperands.size() != 0) {
     this.fBuffer.append(' ');
     for (Iterator it = extendedOperands.iterator(); it.hasNext(); ) {
       this.fBuffer.append(node.getOperator().toString()).append(' ');
       Expression e = (Expression) it.next();
       e.accept(this);
     }
   }
   return false;
 }
 protected static boolean isRemainderExp(Expression remainderExp) {
   while (remainderExp instanceof ParenthesizedExpression) {
     remainderExp = ((ParenthesizedExpression) remainderExp).getExpression();
   }
   if (remainderExp instanceof InfixExpression) {
     InfixExpression exp = ((InfixExpression) remainderExp);
     return REMAINDER.equals(exp.getOperator()) && isNumber(exp.getRightOperand(), 2);
   }
   return false;
 }
 protected static boolean isOddnessCheck(InfixExpression oddnessCheck) {
   if (EQUALS.equals(oddnessCheck.getOperator())) {
     if (isRemainderExp(oddnessCheck.getLeftOperand())) {
       return isNumber(oddnessCheck.getRightOperand(), 1);
     }
     if (isRemainderExp(oddnessCheck.getRightOperand())) {
       return isNumber(oddnessCheck.getLeftOperand(), 1);
     }
   }
   return false;
 }
 /* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.InfixExpression)
  */
 public boolean visit(InfixExpression node) {
   PTInfixExpression inf = InstantiationFactory.eINSTANCE.createPTInfixExpression();
   inf.setLeftOperand(perform(node.getLeftOperand()));
   PTInfixOperator inoper = getParseInfix(node.getOperator());
   if (inoper == null) {
     // It is not one we can handle.
     throw new InvalidExpressionException(
         MessageFormat.format(
             WorkbenchUtilityMessages.ParseTreeCreationFromAST_OperatorTooComplicatedToHandle_EXC_,
             new Object[] {node.getOperator().toString()}));
   }
   inf.setOperator(inoper);
   inf.setRightOperand(perform(node.getRightOperand()));
   List eops = inf.getExtendedOperands();
   List neops = node.extendedOperands();
   int nsize = neops.size();
   for (int i = 0; i < nsize; i++) {
     eops.add(perform((Expression) neops.get(i)));
   }
   expression = inf;
   return false;
 }
  /*
   * Must be one of:
   * <ul>
   * <li>[indexBinding] < [result].length;</li>
   * <li>[result].length > [indexBinding];</li>
   * <li>[indexBinding] < [lengthBinding];</li>
   * <li>[lengthBinding] > [indexBinding];</li>
   * </ul>
   */
  private boolean validateExpression(ForStatement statement) {
    Expression expression = statement.getExpression();
    if (!(expression instanceof InfixExpression)) return false;

    InfixExpression infix = (InfixExpression) expression;

    Expression left = infix.getLeftOperand();
    Expression right = infix.getRightOperand();
    if (left instanceof SimpleName && right instanceof SimpleName) {
      IVariableBinding lengthBinding = fLengthBinding;
      if (lengthBinding == null) return false;

      IBinding leftBinding = ((SimpleName) left).resolveBinding();
      IBinding righBinding = ((SimpleName) right).resolveBinding();

      if (fIndexBinding.equals(leftBinding)) {
        return lengthBinding.equals(righBinding);
      } else if (fIndexBinding.equals(righBinding)) {
        return lengthBinding.equals(leftBinding);
      }

      return false;
    } else if (left instanceof SimpleName) {
      if (!fIndexBinding.equals(((SimpleName) left).resolveBinding())) return false;

      if (!Operator.LESS.equals(infix.getOperator())) return false;

      return validateLengthQuery(right);
    } else if (right instanceof SimpleName) {
      if (!fIndexBinding.equals(((SimpleName) right).resolveBinding())) return false;

      if (!Operator.GREATER.equals(infix.getOperator())) return false;

      return validateLengthQuery(left);
    }

    return false;
  }
  /**
   * 解析exp得到ExpressionNode
   *
   * @param exp
   * @return
   */
  public ExpressionNode getExpressionNode(Expression exp) {
    ExpressionNode result = null;
    ExpressionNode leftPart = null;
    ExpressionNode rightPart = null;
    ExpressionType type = null;
    ExpressionOperator operator = null;
    // InfixExpression.Operator operator;

    if (exp instanceof InfixExpression) {
      ((InfixExpression) exp).getOperator();
    } else if (exp instanceof SimpleName) {

    } else if (exp instanceof NumberLiteral) {

    }
    return result;
  }
  @Override
  public void endVisit(InfixExpression node) {
    Stack<VMExpression> exps = new Stack<VMExpression>();
    exps.push((VMExpression) expressions.pop());
    exps.push((VMExpression) expressions.pop());
    if (node.hasExtendedOperands()) {
      for (int i = 0; i < node.extendedOperands().size(); i++) {
        exps.push((VMExpression) expressions.pop());
      }
    }
    VMInfixExpression.Operator operator =
        VMInfixExpression.Operator.toOperator(node.getOperator().toString());

    VMInfixExpression infixExp = new VMInfixExpression(node, operator);
    while (!exps.empty()) {
      infixExp.getExpressions().add(exps.pop());
    }
    expressions.push(infixExp);
  };