Search in sources :

Example 1 with Operator

use of com.github.javaparser.ast.expr.BinaryExpr.Operator in project drools by kiegroup.

the class DrlxParseUtil method trasformHalfBinaryToBinary.

public static Expression trasformHalfBinaryToBinary(Expression drlxExpr) {
    final Optional<Node> parent = drlxExpr.getParentNode();
    if (drlxExpr instanceof HalfBinaryExpr && parent.isPresent()) {
        HalfBinaryExpr halfBinaryExpr = (HalfBinaryExpr) drlxExpr;
        Expression parentLeft = findLeftLeafOfNameExprTraversingParent(halfBinaryExpr);
        Operator operator = toBinaryExprOperator(halfBinaryExpr.getOperator());
        return new BinaryExpr(parentLeft, halfBinaryExpr.getRight(), operator);
    }
    return drlxExpr;
}
Also used : Operator(com.github.javaparser.ast.expr.BinaryExpr.Operator) HalfBinaryExpr(org.drools.mvel.parser.ast.expr.HalfBinaryExpr) Expression(com.github.javaparser.ast.expr.Expression) ListCreationLiteralExpression(org.drools.mvel.parser.ast.expr.ListCreationLiteralExpression) DrlxExpression(org.drools.mvel.parser.ast.expr.DrlxExpression) MapCreationLiteralExpression(org.drools.mvel.parser.ast.expr.MapCreationLiteralExpression) Node(com.github.javaparser.ast.Node) BinaryExpr(com.github.javaparser.ast.expr.BinaryExpr) HalfBinaryExpr(org.drools.mvel.parser.ast.expr.HalfBinaryExpr)

Aggregations

Node (com.github.javaparser.ast.Node)1 BinaryExpr (com.github.javaparser.ast.expr.BinaryExpr)1 Operator (com.github.javaparser.ast.expr.BinaryExpr.Operator)1 Expression (com.github.javaparser.ast.expr.Expression)1 DrlxExpression (org.drools.mvel.parser.ast.expr.DrlxExpression)1 HalfBinaryExpr (org.drools.mvel.parser.ast.expr.HalfBinaryExpr)1 ListCreationLiteralExpression (org.drools.mvel.parser.ast.expr.ListCreationLiteralExpression)1 MapCreationLiteralExpression (org.drools.mvel.parser.ast.expr.MapCreationLiteralExpression)1