@Override public boolean matches(final INode other, final Match match) { if (_matchWithoutOperator || other instanceof BinaryOperatorExpression) { INode current = other; while (current instanceof BinaryOperatorExpression && (_operatorType == BinaryOperatorType.ANY || ((BinaryOperatorExpression) current).getOperator() == _operatorType)) { current = ((BinaryOperatorExpression) current).getLeft(); } return current != null && _operandPattern.matches(current, match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (_matchWithoutOperator || other instanceof BinaryOperatorExpression) { INode current = other; while (current instanceof BinaryOperatorExpression && (_operatorType == BinaryOperatorType.ANY || ((BinaryOperatorExpression) current).getOperator() == _operatorType)) { current = ((BinaryOperatorExpression) current).getLeft(); } return current != null && _operandPattern.matches(current, match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (_matchWithoutOperator || other instanceof BinaryOperatorExpression) { INode current = other; while (current instanceof BinaryOperatorExpression && (_operatorType == BinaryOperatorType.ANY || ((BinaryOperatorExpression) current).getOperator() == _operatorType)) { current = ((BinaryOperatorExpression) current).getLeft(); } return current != null && _operandPattern.matches(current, match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof BinaryOperatorExpression) { final BinaryOperatorExpression otherExpression = (BinaryOperatorExpression) other; return !otherExpression.isNull() && (otherExpression._operator == _operator || _operator == BinaryOperatorType.ANY || otherExpression._operator == BinaryOperatorType.ANY) && getLeft().matches(otherExpression.getLeft(), match) && getRight().matches(otherExpression.getRight(), match); } return false; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof BinaryOperatorExpression) { final BinaryOperatorExpression otherExpression = (BinaryOperatorExpression) other; return !otherExpression.isNull() && (otherExpression._operator == _operator || _operator == BinaryOperatorType.ANY || otherExpression._operator == BinaryOperatorType.ANY) && getLeft().matches(otherExpression.getLeft(), match) && getRight().matches(otherExpression.getRight(), match); } return false; }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof BinaryOperatorExpression) { final BinaryOperatorExpression otherExpression = (BinaryOperatorExpression) other; return !otherExpression.isNull() && (otherExpression._operator == _operator || _operator == BinaryOperatorType.ANY || otherExpression._operator == BinaryOperatorType.ANY) && getLeft().matches(otherExpression.getLeft(), match) && getRight().matches(otherExpression.getRight(), match); } return false; }
@Override public Void visitBinaryOperatorExpression(final BinaryOperatorExpression node, final Void data) { final int precedence = getPrecedence(node); if (_insertParenthesesForReadability && precedence < EQUALITY) { if (getBinaryOperatorType(node.getLeft()) == node.getOperator()) { parenthesizeIfRequired(node.getLeft(), precedence); } else { parenthesizeIfRequired(node.getLeft(), EQUALITY); } parenthesizeIfRequired(node.getRight(), EQUALITY); } else { parenthesizeIfRequired(node.getLeft(), precedence); parenthesizeIfRequired(node.getRight(), precedence + 1); } return super.visitBinaryOperatorExpression(node, data); }
@Override public Void visitBinaryOperatorExpression(final BinaryOperatorExpression node, final Void data) { final int precedence = getPrecedence(node); if (_insertParenthesesForReadability && precedence < EQUALITY) { if (getBinaryOperatorType(node.getLeft()) == node.getOperator()) { parenthesizeIfRequired(node.getLeft(), precedence); } else { parenthesizeIfRequired(node.getLeft(), EQUALITY); } parenthesizeIfRequired(node.getRight(), EQUALITY); } else { parenthesizeIfRequired(node.getLeft(), precedence); parenthesizeIfRequired(node.getRight(), precedence + 1); } return super.visitBinaryOperatorExpression(node, data); }
@Override public Void visitBinaryOperatorExpression(final BinaryOperatorExpression node, final Void data) { final int precedence = getPrecedence(node); if (_insertParenthesesForReadability && precedence < EQUALITY) { if (getBinaryOperatorType(node.getLeft()) == node.getOperator()) { parenthesizeIfRequired(node.getLeft(), precedence); } else { parenthesizeIfRequired(node.getLeft(), EQUALITY); } parenthesizeIfRequired(node.getRight(), EQUALITY); } else { parenthesizeIfRequired(node.getLeft(), precedence); parenthesizeIfRequired(node.getRight(), precedence + 1); } return super.visitBinaryOperatorExpression(node, data); }
@Override public Void visitBinaryOperatorExpression(final BinaryOperatorExpression node, final Void data) { final BinaryOperatorType operator = node.getOperator(); final TypeReference resultType = operator.isRelational() ? BuiltinTypes.Boolean : getType(node); processBinaryExpressionOperand(node.getRight(), node.getLeft(), operator, resultType); processBinaryExpressionOperand(node.getLeft(), node.getRight(), operator, resultType); return super.visitBinaryOperatorExpression(node, data); }
@Override public Void visitBinaryOperatorExpression(final BinaryOperatorExpression node, final Void data) { final TypeReference leftType = getType(node.getLeft()); final TypeReference rightType = getType(node.getRight()); processBinaryExpressionOperand(node.getLeft(), rightType, node.getOperator()); processBinaryExpressionOperand(node.getRight(), leftType, node.getOperator()); return super.visitBinaryOperatorExpression(node, data); }
@Override public Void visitBinaryOperatorExpression(final BinaryOperatorExpression node, final Void data) { final TypeReference leftType = getType(node.getLeft()); final TypeReference rightType = getType(node.getRight()); processBinaryExpressionOperand(node.getLeft(), rightType, node.getOperator()); processBinaryExpressionOperand(node.getRight(), leftType, node.getOperator()); return super.visitBinaryOperatorExpression(node, data); }
if (binary.getLeft() instanceof NullReferenceExpression || binary.getRight() instanceof NullReferenceExpression) { final ResolveResult leftResult = _resolver.apply(binary.getLeft()); final ResolveResult rightResult = _resolver.apply(binary.getRight()); leftResult.getType() != null && rightResult.getType() != null && (node == binary.getLeft() ? rightResult.getType().isPrimitive() : leftResult.getType().isPrimitive());
@Override public boolean matches(final INode other, final Match match) { if (_pattern.matches(other, match)) { return true; } if (other instanceof BinaryOperatorExpression) { final BinaryOperatorExpression binary = (BinaryOperatorExpression) other; if (_operator != BinaryOperatorType.ANY && binary.getOperator() != _operator) { return false; } final int checkPoint = match.getCheckPoint(); if (matches(binary.getLeft(), match) && matches(binary.getRight(), match)) { return true; } match.restoreCheckPoint(checkPoint); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (_pattern.matches(other, match)) { return true; } if (other instanceof BinaryOperatorExpression) { final BinaryOperatorExpression binary = (BinaryOperatorExpression) other; if (_operator != BinaryOperatorType.ANY && binary.getOperator() != _operator) { return false; } final int checkPoint = match.getCheckPoint(); if (matches(binary.getLeft(), match) && matches(binary.getRight(), match)) { return true; } match.restoreCheckPoint(checkPoint); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (_pattern.matches(other, match)) { return true; } if (other instanceof BinaryOperatorExpression) { final BinaryOperatorExpression binary = (BinaryOperatorExpression) other; if (_operator != BinaryOperatorType.ANY && binary.getOperator() != _operator) { return false; } final int checkPoint = match.getCheckPoint(); if (matches(binary.getLeft(), match) && matches(binary.getRight(), match)) { return true; } match.restoreCheckPoint(checkPoint); } return false; } }
operator == BinaryOperatorType.INEQUALITY) { final Expression left = node.getLeft(); final Expression right = node.getRight();
operator == BinaryOperatorType.INEQUALITY) { final Expression left = node.getLeft(); final Expression right = node.getRight();
operator == BinaryOperatorType.INEQUALITY) { final Expression left = node.getLeft(); final Expression right = node.getRight();