Search in sources :

Example 6 with RuleDescrBuilder

use of org.drools.compiler.lang.api.RuleDescrBuilder in project drools by kiegroup.

the class ParserHelper method end.

@SuppressWarnings("unchecked")
public <T extends DescrBuilder<?, ?>> T end(Class<T> clazz, DescrBuilder<?, ?> builder) {
    if (state.backtracking == 0) {
        if (!(FieldDescrBuilder.class.isAssignableFrom(clazz) || AttributeDescrBuilder.class.isAssignableFrom(clazz) || CEDescrBuilder.class.isAssignableFrom(clazz) || CollectDescrBuilder.class.isAssignableFrom(clazz) || AccumulateDescrBuilder.class.isAssignableFrom(clazz) || ForallDescrBuilder.class.isAssignableFrom(clazz) || BehaviorDescrBuilder.class.isAssignableFrom(clazz) || ConditionalBranchDescrBuilder.class.isAssignableFrom(clazz) || NamedConsequenceDescrBuilder.class.isAssignableFrom(clazz))) {
            popParaphrases();
        }
        if (RuleDescrBuilder.class.isAssignableFrom(clazz)) {
            RuleDescrBuilder ruleDescrBuilder = (RuleDescrBuilder) builder;
            ruleDescrBuilder.end().getDescr().afterRuleAdded(ruleDescrBuilder.getDescr());
        }
        setEnd(builder);
        return (T) builder;
    }
    return null;
}
Also used : CEDescrBuilder(org.drools.compiler.lang.api.CEDescrBuilder) RuleDescrBuilder(org.drools.compiler.lang.api.RuleDescrBuilder) AccumulateDescrBuilder(org.drools.compiler.lang.api.AccumulateDescrBuilder) BehaviorDescrBuilder(org.drools.compiler.lang.api.BehaviorDescrBuilder) NamedConsequenceDescrBuilder(org.drools.compiler.lang.api.NamedConsequenceDescrBuilder)

Example 7 with RuleDescrBuilder

use of org.drools.compiler.lang.api.RuleDescrBuilder in project drools by kiegroup.

the class RuleDescrBuilderImpl method lhs.

public CEDescrBuilder<RuleDescrBuilder, AndDescr> lhs() {
    CEDescrBuilder<RuleDescrBuilder, AndDescr> ce = new CEDescrBuilderImpl<RuleDescrBuilder, AndDescr>(this, new AndDescr());
    descr.setLhs(ce.getDescr());
    return ce;
}
Also used : RuleDescrBuilder(org.drools.compiler.lang.api.RuleDescrBuilder) AndDescr(org.drools.compiler.lang.descr.AndDescr)

Aggregations

RuleDescrBuilder (org.drools.compiler.lang.api.RuleDescrBuilder)7 RecognitionException (org.antlr.runtime.RecognitionException)3 AccumulateDescrBuilder (org.drools.compiler.lang.api.AccumulateDescrBuilder)2 CEDescrBuilder (org.drools.compiler.lang.api.CEDescrBuilder)2 NamedConsequenceDescrBuilder (org.drools.compiler.lang.api.NamedConsequenceDescrBuilder)2 AbstractClassTypeDeclarationBuilder (org.drools.compiler.lang.api.AbstractClassTypeDeclarationBuilder)1 AccumulateImportDescrBuilder (org.drools.compiler.lang.api.AccumulateImportDescrBuilder)1 AttributeDescrBuilder (org.drools.compiler.lang.api.AttributeDescrBuilder)1 BehaviorDescrBuilder (org.drools.compiler.lang.api.BehaviorDescrBuilder)1 DeclareDescrBuilder (org.drools.compiler.lang.api.DeclareDescrBuilder)1 EntryPointDeclarationDescrBuilder (org.drools.compiler.lang.api.EntryPointDeclarationDescrBuilder)1 EnumDeclarationDescrBuilder (org.drools.compiler.lang.api.EnumDeclarationDescrBuilder)1 EnumLiteralDescrBuilder (org.drools.compiler.lang.api.EnumLiteralDescrBuilder)1 FieldDescrBuilder (org.drools.compiler.lang.api.FieldDescrBuilder)1 ForallDescrBuilder (org.drools.compiler.lang.api.ForallDescrBuilder)1 FunctionDescrBuilder (org.drools.compiler.lang.api.FunctionDescrBuilder)1 GlobalDescrBuilder (org.drools.compiler.lang.api.GlobalDescrBuilder)1 ImportDescrBuilder (org.drools.compiler.lang.api.ImportDescrBuilder)1 PackageDescrBuilder (org.drools.compiler.lang.api.PackageDescrBuilder)1 PatternDescrBuilder (org.drools.compiler.lang.api.PatternDescrBuilder)1