Search in sources :

Example 61 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class PackageDescrResourceVisitor method visit.

protected void visit(final ForallDescr descr) {
    checkResource(descr);
    visit(descr.getBasePattern());
    for (BaseDescr o : descr.getDescrs()) {
        visit(o);
    }
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr)

Example 62 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class PackageDescrResourceVisitor method visit.

protected void visit(final CollectDescr descr) {
    checkResource(descr);
    visit(descr.getInputPattern());
    for (BaseDescr d : descr.getDescrs()) {
        visit(d);
    }
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr)

Example 63 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class AndVisitor method visit.

public void visit(AndDescr descr) {
    // if it's the first (implied) `and` wrapping the first level of patterns, skip adding it to the DSL.
    if (this.context.getExprPointerLevel() != 1) {
        final MethodCallExpr andDSL = new MethodCallExpr(null, "and");
        this.context.addExpression(andDSL);
        this.context.pushExprPointer(andDSL::addArgument);
    }
    for (BaseDescr subDescr : descr.getDescrs()) {
        this.context.parentDesc = descr;
        subDescr.accept(visitor);
    }
    if (this.context.getExprPointerLevel() != 1) {
        this.context.popExprPointer();
    }
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr)

Example 64 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class ConditionalElementVisitor method visit.

public void visit(ConditionalElementDescr descr, String methodName) {
    final MethodCallExpr ceDSL = new MethodCallExpr(null, methodName);
    this.context.addExpression(ceDSL);
    this.context.pushExprPointer(ceDSL::addArgument);
    for (BaseDescr subDescr : descr.getDescrs()) {
        subDescr.accept(visitor);
    }
    this.context.popExprPointer();
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr)

Example 65 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class OrVisitor method visit.

public void visit(ConditionalElementDescr descr, String methodName) {
    final MethodCallExpr ceDSL = new MethodCallExpr(null, methodName);
    context.addExpression(ceDSL);
    for (BaseDescr subDescr : descr.getDescrs()) {
        final MethodCallExpr andDSL = new MethodCallExpr(null, "and");
        context.pushExprPointer(andDSL::addArgument);
        subDescr.accept(modelGeneratorVisitor);
        context.popExprPointer();
        ceDSL.addArgument(andDSL);
    }
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) MethodCallExpr(org.drools.javaparser.ast.expr.MethodCallExpr)

Aggregations

BaseDescr (org.drools.compiler.lang.descr.BaseDescr)109 AnnotatedBaseDescr (org.drools.compiler.lang.descr.AnnotatedBaseDescr)60 ConstraintConnectiveDescr (org.drools.compiler.lang.descr.ConstraintConnectiveDescr)23 AtomicExprDescr (org.drools.compiler.lang.descr.AtomicExprDescr)17 ConditionalElementDescr (org.drools.compiler.lang.descr.ConditionalElementDescr)16 BindingDescr (org.drools.compiler.lang.descr.BindingDescr)12 AndDescr (org.drools.compiler.lang.descr.AndDescr)11 RelationalExprDescr (org.drools.compiler.lang.descr.RelationalExprDescr)11 DeclareDescrBuilder (org.drools.compiler.lang.api.DeclareDescrBuilder)9 PatternDescr (org.drools.compiler.lang.descr.PatternDescr)8 OrDescr (org.drools.compiler.lang.descr.OrDescr)7 ArrayList (java.util.ArrayList)6 AccumulateDescrBuilder (org.drools.compiler.lang.api.AccumulateDescrBuilder)6 AnnotatedDescrBuilder (org.drools.compiler.lang.api.AnnotatedDescrBuilder)6 AnnotationDescrBuilder (org.drools.compiler.lang.api.AnnotationDescrBuilder)6 AttributeDescrBuilder (org.drools.compiler.lang.api.AttributeDescrBuilder)6 BehaviorDescrBuilder (org.drools.compiler.lang.api.BehaviorDescrBuilder)6 CEDescrBuilder (org.drools.compiler.lang.api.CEDescrBuilder)6 CollectDescrBuilder (org.drools.compiler.lang.api.CollectDescrBuilder)6 ConditionalBranchDescrBuilder (org.drools.compiler.lang.api.ConditionalBranchDescrBuilder)6