Search in sources :

Example 1 with ParseResultVisitor

use of org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor in project drools by kiegroup.

the class PatternDSL method addNullSafeExpr.

private void addNullSafeExpr(ConstraintParser constraintParser, String patternIdentifier, List<PatternConstraintParseResult> patternConstraintParseResults) {
    final List<Expression> nullSafeExpressions = patternConstraintParseResults.stream().flatMap(r -> r.getDrlxParseResult().acceptWithReturnValue(new ParseResultVisitor<List<Expression>>() {

        @Override
        public List<Expression> onSuccess(DrlxParseSuccess t) {
            return t.getNullSafeExpressions();
        }

        @Override
        public List<Expression> onFail(DrlxParseFail failure) {
            return Collections.emptyList();
        }
    }).stream()).collect(Collectors.toList());
    List<Expression> newNullSafeExpressions = reverseDistinct(nullSafeExpressions);
    newNullSafeExpressions.forEach(expr -> {
        String nullSafeExpression = printNode(expr);
        DrlxParseResult nullSafeExpressionParsed = constraintParser.drlxParse(patternType, patternIdentifier, nullSafeExpression, false);
        patternConstraintParseResults.add(0, new PatternConstraintParseResult(nullSafeExpression, patternIdentifier, nullSafeExpressionParsed));
    });
}
Also used : DrlxParseUtil.validateDuplicateBindings(org.drools.modelcompiler.builder.generator.DrlxParseUtil.validateDuplicateBindings) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult) AggregateKey(org.drools.modelcompiler.builder.generator.AggregateKey) DrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess) PrintUtil.printNode(org.drools.mvel.parser.printer.PrintUtil.printNode) PatternSourceDescr(org.drools.drl.ast.descr.PatternSourceDescr) DeclarationSpec(org.drools.modelcompiler.builder.generator.DeclarationSpec) DescrBuildError(org.drools.compiler.compiler.DescrBuildError) DrlxParseUtil(org.drools.modelcompiler.builder.generator.DrlxParseUtil) ConstraintExpression(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintExpression) DrlxParseUtil.getPatternListenedProperties(org.drools.modelcompiler.builder.generator.DrlxParseUtil.getPatternListenedProperties) PatternDescr(org.drools.drl.ast.descr.PatternDescr) InvalidExpressionErrorResult(org.drools.modelcompiler.builder.errors.InvalidExpressionErrorResult) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) GENERATED_VARIABLE_PREFIX(org.drools.model.impl.VariableImpl.GENERATED_VARIABLE_PREFIX) ConstraintUtil(org.drools.modelcompiler.builder.generator.ConstraintUtil) AccumulateDescr(org.drools.drl.ast.descr.AccumulateDescr) NamesGenerator.generateName(org.drools.model.impl.NamesGenerator.generateName) Expression(com.github.javaparser.ast.expr.Expression) ConstraintParser(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser) BinaryExpr(com.github.javaparser.ast.expr.BinaryExpr) ExprConstraintDescr(org.drools.drl.ast.descr.ExprConstraintDescr) PackageModel(org.drools.modelcompiler.builder.PackageModel) WindowReferenceGenerator(org.drools.modelcompiler.builder.generator.WindowReferenceGenerator) ClassUtils(org.drools.core.util.ClassUtils) Collection(java.util.Collection) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr) Set(java.util.Set) PatternBuilder.lookAheadFieldsOfIdentifier(org.drools.compiler.rule.builder.PatternBuilder.lookAheadFieldsOfIdentifier) StreamUtils.optionalToStream(org.drools.modelcompiler.util.StreamUtils.optionalToStream) FromVisitor(org.drools.modelcompiler.builder.generator.visitor.FromVisitor) Collectors(java.util.stream.Collectors) BaseDescr(org.drools.drl.ast.descr.BaseDescr) Objects(java.util.Objects) RuleContext(org.drools.modelcompiler.builder.generator.RuleContext) List(java.util.List) SingleDrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess) DSLNode(org.drools.modelcompiler.builder.generator.visitor.DSLNode) ParseResultVoidVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVoidVisitor) Watch(org.kie.api.definition.rule.Watch) Optional(java.util.Optional) ParseResultVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor) Collections(java.util.Collections) DrlxParseFail(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail) ConstraintExpression(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintExpression) Expression(com.github.javaparser.ast.expr.Expression) DrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess) SingleDrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess) ParseResultVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult) DrlxParseFail(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail)

Example 2 with ParseResultVisitor

use of org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor in project drools by kiegroup.

the class AccumulateVisitor method binaryExprParameter.

private Optional<NewBinding> binaryExprParameter(PatternDescr basePattern, AccumulateDescr.AccumulateFunctionCallDescr function, MethodCallExpr functionDSL, String bindingId, String accumulateFunctionParameterStr) {
    final DrlxParseResult parseResult = ConstraintParser.defaultConstraintParser(context, packageModel).drlxParse(Object.class, bindingId, accumulateFunctionParameterStr);
    Optional<NewBinding> optNewBinding = parseResult.acceptWithReturnValue(new ParseResultVisitor<Optional<NewBinding>>() {

        @Override
        public Optional<NewBinding> onSuccess(DrlxParseSuccess drlxParseResult) {
            SingleDrlxParseSuccess singleResult = (SingleDrlxParseSuccess) drlxParseResult;
            Class<?> exprRawClass = singleResult.getExprRawClass();
            AccumulateFunction accumulateFunction = getAccumulateFunction(function, exprRawClass);
            validateAccFunctionTypeAgainstPatternType(context, basePattern, accumulateFunction);
            final String bindExpressionVariable = context.getExprId(accumulateFunction.getResultType(), singleResult.getLeft().toString());
            singleResult.setExprBinding(bindExpressionVariable);
            context.addDeclarationReplacing(new DeclarationSpec(singleResult.getPatternBinding(), exprRawClass));
            context.getExpressions().forEach(expression -> replaceTypeInExprLambda(bindingId, exprRawClass, expression));
            functionDSL.addArgument(createAccSupplierExpr(accumulateFunction));
            final MethodCallExpr newBindingFromBinary = AccumulateVisitor.this.buildBinding(bindExpressionVariable, singleResult.getUsedDeclarations(), singleResult.getExpr());
            context.addDeclarationReplacing(new DeclarationSpec(bindExpressionVariable, exprRawClass));
            functionDSL.addArgument(context.getVarExpr(bindExpressionVariable));
            return Optional.of(new NewBinding(Collections.emptyList(), newBindingFromBinary));
        }

        @Override
        public Optional<NewBinding> onFail(DrlxParseFail failure) {
            return Optional.empty();
        }
    });
    return optNewBinding;
}
Also used : SingleDrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess) REACT_ON_CALL(org.drools.modelcompiler.builder.generator.DslMethodNames.REACT_ON_CALL) ModelGeneratorVisitor(org.drools.modelcompiler.builder.generator.visitor.ModelGeneratorVisitor) ACCUMULATE_CALL(org.drools.modelcompiler.builder.generator.DslMethodNames.ACCUMULATE_CALL) DeclarationSpec(org.drools.modelcompiler.builder.generator.DeclarationSpec) DrlxParseUtil(org.drools.modelcompiler.builder.generator.DrlxParseUtil) PatternDescr(org.drools.drl.ast.descr.PatternDescr) InvalidExpressionErrorResult(org.drools.modelcompiler.builder.errors.InvalidExpressionErrorResult) ExpressionTyperContext(org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyperContext) LiteralExpr(com.github.javaparser.ast.expr.LiteralExpr) AccumulateUtil(org.drools.compiler.rule.builder.util.AccumulateUtil) AccumulateFunction(org.kie.api.runtime.rule.AccumulateFunction) Expression(com.github.javaparser.ast.expr.Expression) ConstraintParser(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser) PatternExpressionBuilder(org.drools.modelcompiler.builder.generator.expression.PatternExpressionBuilder) BinaryExpr(com.github.javaparser.ast.expr.BinaryExpr) Node(com.github.javaparser.ast.Node) PackageModel(org.drools.modelcompiler.builder.PackageModel) NodeList(com.github.javaparser.ast.NodeList) AND_CALL(org.drools.modelcompiler.builder.generator.DslMethodNames.AND_CALL) Collection(java.util.Collection) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr) Set(java.util.Set) LambdaUtil(org.drools.modelcompiler.util.LambdaUtil) BaseDescr(org.drools.drl.ast.descr.BaseDescr) VALUE_OF_CALL(org.drools.modelcompiler.builder.generator.DslMethodNames.VALUE_OF_CALL) Objects(java.util.Objects) List(java.util.List) TypedExpression(org.drools.modelcompiler.builder.generator.TypedExpression) SingleDrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess) Optional(java.util.Optional) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) DrlxParseFail(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail) DrlxParseUtil.validateDuplicateBindings(org.drools.modelcompiler.builder.generator.DrlxParseUtil.validateDuplicateBindings) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult) AbstractExpressionBuilder(org.drools.modelcompiler.builder.generator.expression.AbstractExpressionBuilder) LambdaExpr(com.github.javaparser.ast.expr.LambdaExpr) ExpressionStmt(com.github.javaparser.ast.stmt.ExpressionStmt) DrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess) PrintUtil.printNode(org.drools.mvel.parser.printer.PrintUtil.printNode) Parameter(com.github.javaparser.ast.body.Parameter) Pattern(org.drools.core.rule.Pattern) ArrayList(java.util.ArrayList) ACC_FUNCTION_CALL(org.drools.modelcompiler.builder.generator.DslMethodNames.ACC_FUNCTION_CALL) HashSet(java.util.HashSet) CollectListAccumulateFunction(org.drools.core.base.accumulators.CollectListAccumulateFunction) AccumulateDescr(org.drools.drl.ast.descr.AccumulateDescr) DrlxParseUtil.getLiteralExpressionType(org.drools.modelcompiler.builder.generator.DrlxParseUtil.getLiteralExpressionType) DslMethodNames.createDslTopLevelMethod(org.drools.modelcompiler.builder.generator.DslMethodNames.createDslTopLevelMethod) AndDescr(org.drools.drl.ast.descr.AndDescr) ReplaceTypeInLambda.replaceTypeInExprLambda(org.drools.modelcompiler.util.lambdareplace.ReplaceTypeInLambda.replaceTypeInExprLambda) BIND_CALL(org.drools.modelcompiler.builder.generator.DslMethodNames.BIND_CALL) Optional.ofNullable(java.util.Optional.ofNullable) BIND_AS_CALL(org.drools.modelcompiler.builder.generator.DslMethodNames.BIND_AS_CALL) DrlNameExpr(org.drools.mvel.parser.ast.expr.DrlNameExpr) NameExpr(com.github.javaparser.ast.expr.NameExpr) MethodReferenceExpr(com.github.javaparser.ast.expr.MethodReferenceExpr) ExpressionTyper(org.drools.modelcompiler.builder.generator.expressiontyper.ExpressionTyper) RuleContext(org.drools.modelcompiler.builder.generator.RuleContext) Collectors.toList(java.util.stream.Collectors.toList) CollectAccumulator(org.drools.core.base.accumulators.CollectAccumulator) CollectSetAccumulateFunction(org.drools.core.base.accumulators.CollectSetAccumulateFunction) ParseResultVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor) Collections(java.util.Collections) Optional(java.util.Optional) DrlxParseFail(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail) DeclarationSpec(org.drools.modelcompiler.builder.generator.DeclarationSpec) SingleDrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess) DrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult) AccumulateFunction(org.kie.api.runtime.rule.AccumulateFunction) CollectListAccumulateFunction(org.drools.core.base.accumulators.CollectListAccumulateFunction) CollectSetAccumulateFunction(org.drools.core.base.accumulators.CollectSetAccumulateFunction) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr)

Example 3 with ParseResultVisitor

use of org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor in project drools by kiegroup.

the class AccumulateVisitor method visit.

protected Optional<AccumulateVisitorPatternDSL.NewBinding> visit(RuleContext context, AccumulateDescr.AccumulateFunctionCallDescr function, MethodCallExpr accumulateDSL, PatternDescr basePattern, boolean inputPatternHasConstraints) {
    context.pushExprPointer(accumulateDSL::addArgument);
    final MethodCallExpr functionDSL = new MethodCallExpr(null, "accFunction");
    final String expression = function.getParams()[0];
    final Expression expr = DrlxParseUtil.parseExpression(expression).getExpr();
    final String bindingId = Optional.ofNullable(function.getBind()).orElse(basePattern.getIdentifier());
    Optional<AccumulateVisitorPatternDSL.NewBinding> newBinding = Optional.empty();
    if (expr instanceof BinaryExpr) {
        final DrlxParseResult parseResult = new ConstraintParser(context, packageModel).drlxParse(Object.class, bindingId, expression);
        newBinding = parseResult.acceptWithReturnValue(new ParseResultVisitor<Optional<AccumulateVisitorPatternDSL.NewBinding>>() {

            @Override
            public Optional<AccumulateVisitorPatternDSL.NewBinding> onSuccess(DrlxParseSuccess drlxParseResult) {
                final AccumulateFunction accumulateFunction = AccumulateVisitor.this.getAccumulateFunction(function, drlxParseResult.getExprType());
                final String bindExpressionVariable = context.getExprId(accumulateFunction.getResultType(), drlxParseResult.getLeft().toString());
                drlxParseResult.setExprBinding(bindExpressionVariable);
                context.addDeclarationReplacing(new DeclarationSpec(drlxParseResult.getPatternBinding(), drlxParseResult.getExprType()));
                functionDSL.addArgument(new ClassExpr(toType(accumulateFunction.getClass())));
                final MethodCallExpr newBindingFromBinary = AccumulateVisitor.this.buildBinding(bindExpressionVariable, drlxParseResult.getUsedDeclarations(), drlxParseResult.getExpr());
                context.addDeclarationReplacing(new DeclarationSpec(bindExpressionVariable, drlxParseResult.getExprType()));
                functionDSL.addArgument(new NameExpr(toVar(bindExpressionVariable)));
                return Optional.of(new AccumulateVisitorPatternDSL.NewBinding(Optional.empty(), newBindingFromBinary));
            }

            @Override
            public Optional<AccumulateVisitorPatternDSL.NewBinding> onFail(DrlxParseFail failure) {
                return Optional.empty();
            }
        });
    } else if (expr instanceof MethodCallExpr) {
        final DrlxParseUtil.RemoveRootNodeResult methodCallWithoutRootNode = DrlxParseUtil.removeRootNode(expr);
        final String rootNodeName = getRootNodeName(methodCallWithoutRootNode);
        final TypedExpression typedExpression = parseMethodCallType(context, rootNodeName, methodCallWithoutRootNode.getWithoutRootNode());
        final Class<?> methodCallExprType = typedExpression.getType();
        final AccumulateFunction accumulateFunction = getAccumulateFunction(function, methodCallExprType);
        final Class accumulateFunctionResultType = accumulateFunction.getResultType();
        functionDSL.addArgument(new ClassExpr(toType(accumulateFunction.getClass())));
        // Every expression in an accumulate function gets transformed in a bind expression with a generated id
        // Then the accumulate function will have that binding expression as a source
        final String bindExpressionVariable = context.getExprId(accumulateFunctionResultType, typedExpression.toString());
        Expression withThis = DrlxParseUtil.prepend(DrlxParseUtil._THIS_EXPR, typedExpression.getExpression());
        DrlxParseSuccess result = new DrlxParseSuccess(accumulateFunctionResultType, "", rootNodeName, withThis, accumulateFunctionResultType).setLeft(typedExpression).setExprBinding(bindExpressionVariable);
        final MethodCallExpr binding = expressionBuilder.buildBinding(result);
        newBinding = Optional.of(new AccumulateVisitorPatternDSL.NewBinding(Optional.of(result.getPatternBinding()), binding));
        context.addDeclarationReplacing(new DeclarationSpec(bindExpressionVariable, methodCallExprType));
        functionDSL.addArgument(new NameExpr(toVar(bindExpressionVariable)));
        context.addDeclarationReplacing(new DeclarationSpec(bindingId, accumulateFunctionResultType));
    } else if (expr instanceof NameExpr) {
        final Class<?> declarationClass = context.getDeclarationById(expr.toString()).orElseThrow(RuntimeException::new).getDeclarationClass();
        final String nameExpr = ((NameExpr) expr).getName().asString();
        final AccumulateFunction accumulateFunction = getAccumulateFunction(function, declarationClass);
        functionDSL.addArgument(new ClassExpr(toType(accumulateFunction.getClass())));
        functionDSL.addArgument(new NameExpr(toVar(nameExpr)));
        Class accumulateFunctionResultType = accumulateFunction.getResultType();
        if (accumulateFunctionResultType == Comparable.class && (Comparable.class.isAssignableFrom(declarationClass) || declarationClass.isPrimitive())) {
            accumulateFunctionResultType = declarationClass;
        }
        context.addDeclarationReplacing(new DeclarationSpec(bindingId, accumulateFunctionResultType));
    } else {
        throw new UnsupportedOperationException("Unsupported expression " + expr);
    }
    final MethodCallExpr asDSL = new MethodCallExpr(functionDSL, "as");
    asDSL.addArgument(new NameExpr(toVar(bindingId)));
    accumulateDSL.addArgument(asDSL);
    context.popExprPointer();
    return newBinding;
}
Also used : ConstraintParser(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser) BinaryExpr(org.drools.javaparser.ast.expr.BinaryExpr) NameExpr(org.drools.javaparser.ast.expr.NameExpr) DrlxParseFail(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail) DeclarationSpec(org.drools.modelcompiler.builder.generator.DeclarationSpec) Expression(org.drools.javaparser.ast.expr.Expression) TypedExpression(org.drools.modelcompiler.builder.generator.TypedExpression) DrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess) ParseResultVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult) ClassExpr(org.drools.javaparser.ast.expr.ClassExpr) AccumulateFunction(org.kie.api.runtime.rule.AccumulateFunction) TypedExpression(org.drools.modelcompiler.builder.generator.TypedExpression) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr)

Example 4 with ParseResultVisitor

use of org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor in project drools by kiegroup.

the class PatternDSL method addImplicitCastExpr.

private void addImplicitCastExpr(ConstraintParser constraintParser, String patternIdentifier, List<PatternConstraintParseResult> patternConstraintParseResults) {
    final boolean hasInstanceOfExpr = patternConstraintParseResults.stream().anyMatch(r -> r.getDrlxParseResult().acceptWithReturnValue(new ParseResultVisitor<Boolean>() {

        @Override
        public Boolean onSuccess(DrlxParseSuccess t) {
            Expression expr = t.getExpr();
            return expr != null && expr.isInstanceOfExpr();
        }

        @Override
        public Boolean onFail(DrlxParseFail failure) {
            return false;
        }
    }));
    final Optional<Expression> implicitCastExpression = patternConstraintParseResults.stream().flatMap(r -> optionalToStream(r.getDrlxParseResult().acceptWithReturnValue(new ParseResultVisitor<Optional<Expression>>() {

        @Override
        public Optional<Expression> onSuccess(DrlxParseSuccess t) {
            return t.getImplicitCastExpression();
        }

        @Override
        public Optional<Expression> onFail(DrlxParseFail failure) {
            return Optional.empty();
        }
    }))).findFirst();
    implicitCastExpression.ifPresent(ce -> {
        if (!hasInstanceOfExpr) {
            String instanceOfExpression = printNode(ce);
            DrlxParseResult instanceOfExpressionParsed = constraintParser.drlxParse(patternType, patternIdentifier, instanceOfExpression, false);
            patternConstraintParseResults.add(0, new PatternConstraintParseResult(instanceOfExpression, patternIdentifier, instanceOfExpressionParsed));
        }
    });
}
Also used : DrlxParseUtil.validateDuplicateBindings(org.drools.modelcompiler.builder.generator.DrlxParseUtil.validateDuplicateBindings) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult) AggregateKey(org.drools.modelcompiler.builder.generator.AggregateKey) DrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess) PrintUtil.printNode(org.drools.mvel.parser.printer.PrintUtil.printNode) PatternSourceDescr(org.drools.drl.ast.descr.PatternSourceDescr) DeclarationSpec(org.drools.modelcompiler.builder.generator.DeclarationSpec) DescrBuildError(org.drools.compiler.compiler.DescrBuildError) DrlxParseUtil(org.drools.modelcompiler.builder.generator.DrlxParseUtil) ConstraintExpression(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintExpression) DrlxParseUtil.getPatternListenedProperties(org.drools.modelcompiler.builder.generator.DrlxParseUtil.getPatternListenedProperties) PatternDescr(org.drools.drl.ast.descr.PatternDescr) InvalidExpressionErrorResult(org.drools.modelcompiler.builder.errors.InvalidExpressionErrorResult) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) GENERATED_VARIABLE_PREFIX(org.drools.model.impl.VariableImpl.GENERATED_VARIABLE_PREFIX) ConstraintUtil(org.drools.modelcompiler.builder.generator.ConstraintUtil) AccumulateDescr(org.drools.drl.ast.descr.AccumulateDescr) NamesGenerator.generateName(org.drools.model.impl.NamesGenerator.generateName) Expression(com.github.javaparser.ast.expr.Expression) ConstraintParser(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser) BinaryExpr(com.github.javaparser.ast.expr.BinaryExpr) ExprConstraintDescr(org.drools.drl.ast.descr.ExprConstraintDescr) PackageModel(org.drools.modelcompiler.builder.PackageModel) WindowReferenceGenerator(org.drools.modelcompiler.builder.generator.WindowReferenceGenerator) ClassUtils(org.drools.core.util.ClassUtils) Collection(java.util.Collection) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr) Set(java.util.Set) PatternBuilder.lookAheadFieldsOfIdentifier(org.drools.compiler.rule.builder.PatternBuilder.lookAheadFieldsOfIdentifier) StreamUtils.optionalToStream(org.drools.modelcompiler.util.StreamUtils.optionalToStream) FromVisitor(org.drools.modelcompiler.builder.generator.visitor.FromVisitor) Collectors(java.util.stream.Collectors) BaseDescr(org.drools.drl.ast.descr.BaseDescr) Objects(java.util.Objects) RuleContext(org.drools.modelcompiler.builder.generator.RuleContext) List(java.util.List) SingleDrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess) DSLNode(org.drools.modelcompiler.builder.generator.visitor.DSLNode) ParseResultVoidVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVoidVisitor) Watch(org.kie.api.definition.rule.Watch) Optional(java.util.Optional) ParseResultVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor) Collections(java.util.Collections) DrlxParseFail(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail) ConstraintExpression(org.drools.modelcompiler.builder.generator.drlxparse.ConstraintExpression) Expression(com.github.javaparser.ast.expr.Expression) DrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess) SingleDrlxParseSuccess(org.drools.modelcompiler.builder.generator.drlxparse.SingleDrlxParseSuccess) ParseResultVisitor(org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult) DrlxParseFail(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail)

Aggregations

DeclarationSpec (org.drools.modelcompiler.builder.generator.DeclarationSpec)4 ConstraintParser (org.drools.modelcompiler.builder.generator.drlxparse.ConstraintParser)4 DrlxParseFail (org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseFail)4 DrlxParseResult (org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult)4 DrlxParseSuccess (org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseSuccess)4 ParseResultVisitor (org.drools.modelcompiler.builder.generator.drlxparse.ParseResultVisitor)4 BinaryExpr (com.github.javaparser.ast.expr.BinaryExpr)3 Expression (com.github.javaparser.ast.expr.Expression)3 MethodCallExpr (com.github.javaparser.ast.expr.MethodCallExpr)3 ArrayList (java.util.ArrayList)3 Collection (java.util.Collection)3 Collections (java.util.Collections)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Objects (java.util.Objects)3 Optional (java.util.Optional)3 Set (java.util.Set)3 AccumulateDescr (org.drools.drl.ast.descr.AccumulateDescr)3 BaseDescr (org.drools.drl.ast.descr.BaseDescr)3 PatternDescr (org.drools.drl.ast.descr.PatternDescr)3