Search in sources :

Example 11 with MutableTypeConstraint

use of org.drools.core.rule.MutableTypeConstraint in project drools by kiegroup.

the class DefaultBetaConstraintsMetric method cloneIfInUse.

@Override
public DefaultBetaConstraintsMetric cloneIfInUse() {
    if (constraints[0] instanceof MutableTypeConstraint && ((MutableTypeConstraint) constraints[0]).setInUse()) {
        BetaNodeFieldConstraint[] clonedConstraints = new BetaNodeFieldConstraint[constraints.length];
        for (int i = 0; i < constraints.length; i++) {
            clonedConstraints[i] = constraints[i].cloneIfInUse();
        }
        DefaultBetaConstraintsMetric clone = new DefaultBetaConstraintsMetric();
        clone.constraints = clonedConstraints;
        clone.disableIndexing = disableIndexing;
        clone.indexPrecedenceOption = indexPrecedenceOption;
        clone.indexed = indexed;
        return clone;
    }
    return this;
}
Also used : MutableTypeConstraint(org.drools.core.rule.MutableTypeConstraint) BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) MutableTypeConstraint(org.drools.core.rule.MutableTypeConstraint)

Example 12 with MutableTypeConstraint

use of org.drools.core.rule.MutableTypeConstraint in project drools by kiegroup.

the class QuadroupleBetaConstraintsMetric method cloneIfInUse.

@Override
public QuadroupleBetaConstraintsMetric cloneIfInUse() {
    if (constraints[0] instanceof MutableTypeConstraint && ((MutableTypeConstraint) constraints[0]).setInUse()) {
        BetaNodeFieldConstraint[] clonedConstraints = new BetaNodeFieldConstraint[constraints.length];
        for (int i = 0; i < constraints.length; i++) {
            clonedConstraints[i] = constraints[i].cloneIfInUse();
        }
        QuadroupleBetaConstraintsMetric clone = new QuadroupleBetaConstraintsMetric(clonedConstraints, indexPrecedenceOption, disableIndexing);
        clone.indexed = indexed;
        return clone;
    }
    return this;
}
Also used : MutableTypeConstraint(org.drools.core.rule.MutableTypeConstraint) BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) MutableTypeConstraint(org.drools.core.rule.MutableTypeConstraint)

Aggregations

MutableTypeConstraint (org.drools.core.rule.MutableTypeConstraint)12 BetaNodeFieldConstraint (org.drools.core.spi.BetaNodeFieldConstraint)8 DescrBuildError (org.drools.compiler.compiler.DescrBuildError)4 ArrayElementReader (org.drools.core.base.extractors.ArrayElementReader)4 Declaration (org.drools.core.rule.Declaration)4 Constraint (org.drools.core.spi.Constraint)4 AnalysisResult (org.drools.compiler.compiler.AnalysisResult)2 SelfReferenceClassFieldReader (org.drools.core.base.extractors.SelfReferenceClassFieldReader)2 Pattern (org.drools.core.rule.Pattern)2 MvelConstraint (org.drools.core.rule.constraint.MvelConstraint)2 Accumulator (org.drools.core.spi.Accumulator)2 InternalReadAccessor (org.drools.core.spi.InternalReadAccessor)2 MvelAccumulator (org.drools.core.spi.MvelAccumulator)2 MVELConstraint (org.drools.mvel.MVELConstraint)2 AccumulateFunction (org.kie.api.runtime.rule.AccumulateFunction)2 AccumulateFunctionCallDescr (org.drools.compiler.lang.descr.AccumulateDescr.AccumulateFunctionCallDescr)1 MVELAccumulatorFunctionExecutor (org.drools.core.base.accumulators.MVELAccumulatorFunctionExecutor)1 MVELAccumulator (org.drools.core.base.mvel.MVELAccumulator)1 MVELCompilationUnit (org.drools.core.base.mvel.MVELCompilationUnit)1 IndexableConstraint (org.drools.core.rule.IndexableConstraint)1