Search in sources :

Example 1 with DSLNode

use of org.drools.modelcompiler.builder.generator.visitor.DSLNode in project drools by kiegroup.

the class FlowDSLPattern method buildConstraint.

private void buildConstraint(PatternDescr pattern, Class<?> patternType, PatternConstraintParseResult patternConstraintParseResult) {
    DrlxParseResult drlxParseResult1 = patternConstraintParseResult.getDrlxParseResult();
    String expression = patternConstraintParseResult.getExpression();
    drlxParseResult1.accept(drlxParseResult -> {
        DSLNode constraint;
        if (drlxParseResult.getExpr() instanceof OOPathExpr) {
            constraint = new ConstraintOOPath(context, packageModel, pattern, patternType, patternConstraintParseResult, expression, drlxParseResult);
        } else {
            constraint = new FlowDSLSimpleConstraint(context, pattern, drlxParseResult);
        }
        constraint.buildPattern();
    });
}
Also used : DSLNode(org.drools.modelcompiler.builder.generator.visitor.DSLNode) OOPathExpr(org.drools.javaparser.ast.drlx.OOPathExpr) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult)

Example 2 with DSLNode

use of org.drools.modelcompiler.builder.generator.visitor.DSLNode in project drools by kiegroup.

the class PatternDSLPattern method buildConstraint.

private void buildConstraint(PatternDescr pattern, Class<?> patternType, PatternConstraintParseResult patternConstraintParseResult) {
    DrlxParseResult drlxParseResult1 = patternConstraintParseResult.getDrlxParseResult();
    String expression = patternConstraintParseResult.getExpression();
    drlxParseResult1.accept(drlxParseResult -> {
        DSLNode constraint;
        if (drlxParseResult.getExpr() instanceof OOPathExpr) {
            constraint = new ConstraintOOPath(context, packageModel, pattern, patternType, patternConstraintParseResult, expression, drlxParseResult);
        } else {
            constraint = new PatternDSLSimpleConstraint(context, pattern, drlxParseResult);
        }
        constraint.buildPattern();
    });
}
Also used : DSLNode(org.drools.modelcompiler.builder.generator.visitor.DSLNode) OOPathExpr(org.drools.javaparser.ast.drlx.OOPathExpr) DrlxParseResult(org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult)

Aggregations

OOPathExpr (org.drools.javaparser.ast.drlx.OOPathExpr)2 DrlxParseResult (org.drools.modelcompiler.builder.generator.drlxparse.DrlxParseResult)2 DSLNode (org.drools.modelcompiler.builder.generator.visitor.DSLNode)2