Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.InfixExpression$Operator


      }
      break;
    }

    case ASTNode.INFIX_EXPRESSION: {
      final InfixExpression iexp = (InfixExpression) node;
      final InfixExpression.Operator op = iexp.getOperator();
      if (Util.isLegalInfixOperator(op)) {
        if (Util.inNeedOfTransformation(op)) {
          final ISourceRange range = new SourceRange(iexp
              .getStartPosition(), iexp.getLength());
          this.legalEncounteredInfixExpressionSourceLocations
              .add(range);
        }
        this.processExpression(iexp.getLeftOperand());
        this.processExpression(iexp.getRightOperand());
      }

      else if (!Util.isSuspiciousInfixOperator(op))
        throw new DefinitelyNotEnumerizableOperationException(
            Messages.ASTNodeProcessor_IllegalInfixExpression, op, node);
View Full Code Here


      }
      break;
    }

    case ASTNode.INFIX_EXPRESSION: {
      final InfixExpression ie = (InfixExpression) node;
      final InfixExpression.Operator op = ie.getOperator();
      if (Util.isLegalInfixOperator(op)) {
        if (Util.inNeedOfTransformation(op)) {
          final ISourceRange range = new SourceRange(ie
              .getStartPosition(), ie.getLength());
          this.legalEncounteredInfixExpressionSourceLocations
              .add(range);
        }
        this.processExpression(ie.getLeftOperand());
        this.processExpression(ie.getRightOperand());
      }

      else if (!Util.isSuspiciousInfixOperator(op))
        throw new DefinitelyNotEnumerizableOperationException(
            Messages.ASTNodeProcessor_IllegalInfixExpression, op, node);
View Full Code Here

  public static Collection extractLegalInfixExpressionsInNeedOfTransformation(
      Collection col) {
    final Collection ret = new LinkedHashSet();
    for (final Iterator it = col.iterator(); it.hasNext();) {
      final InfixExpression ie = (InfixExpression) it.next();
      if (inNeedOfTransformation(ie.getOperator()))
        ret.add(ie);
    }
    return ret;
  }
View Full Code Here

        ConditionalExpression conditionalExpression = workingUnit.getAST().newConditionalExpression();
        conditionalExpression.setElseExpression(castRet);
        conditionalExpression.setThenExpression(workingUnit.getAST().newNullLiteral() );

        InfixExpression nullTest = workingUnit.getAST().newInfixExpression();
        nullTest.setOperator(InfixExpression.Operator.EQUALS);
        nullTest.setRightOperand(workingUnit.getAST().newNullLiteral());
        Expression initialLoad = (SimpleName) ASTNode.copySubtree(cloneInvoke.getAST(), original);
        nullTest.setLeftOperand(initialLoad);

        conditionalExpression.setExpression(nullTest);

        rewrite.replace(original, conditionalExpression, null);
View Full Code Here

    protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) {
        assert rewrite != null;
        assert numberExpression != null;

        final AST ast = rewrite.getAST();
        InfixExpression correctOddnessCheck = ast.newInfixExpression();
        InfixExpression remainderExp = ast.newInfixExpression();

        correctOddnessCheck.setLeftOperand(remainderExp);
        correctOddnessCheck.setOperator(NOT_EQUALS);
        correctOddnessCheck.setRightOperand(ast.newNumberLiteral("0"));

        remainderExp.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression));
        remainderExp.setOperator(REMAINDER);
        remainderExp.setRightOperand(ast.newNumberLiteral("2"));

        return correctOddnessCheck;
    }
View Full Code Here

          new StatementTarget(method, true));
    }

    private boolean isThisCondition(Expression condition) {
      if (condition instanceof InfixExpression) {
        InfixExpression infixExpression = (InfixExpression) condition;
        Expression rightOperand = infixExpression.getRightOperand();
        if (infixExpression.getOperator() == InfixExpression.Operator.EQUALS
            && AstNodeUtils.isMethodInvocation(rightOperand, "getItemByItemId(java.lang.String)")) {
          Expression idExpression = DomGenerics.arguments(rightOperand).get(0);
          String idSource = getEditor().getSource(idExpression);
          if (m_id.getName().equals(idSource)) {
            return true;
View Full Code Here

    if (parent instanceof ReturnStatement) {
      return false;
    }

    if (parent instanceof InfixExpression) {
      InfixExpression ie = (InfixExpression) parent;
      Operator op = ie.getOperator();
      if (op.equals(InfixExpression.Operator.EQUALS)
          || op.equals(InfixExpression.Operator.GREATER)
          || op.equals(InfixExpression.Operator.GREATER_EQUALS)
          || op.equals(InfixExpression.Operator.LESS)
          || op.equals(InfixExpression.Operator.LESS_EQUALS)
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.InfixExpression$Operator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.