Search in sources :

Example 31 with BetaNodeFieldConstraint

use of org.drools.core.spi.BetaNodeFieldConstraint in project drools by kiegroup.

the class QuadroupleBetaConstraintsTest method testTwoIndxed.

@Test
public void testTwoIndxed() {
    BetaNodeFieldConstraint constraint0 = getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint1 = getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint3 = getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint4 = getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint[] constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = (BetaNodeFieldConstraint) getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    constraint1 = (BetaNodeFieldConstraint) getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint3 = (BetaNodeFieldConstraint) getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    constraint4 = (BetaNodeFieldConstraint) getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = (BetaNodeFieldConstraint) getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    constraint1 = (BetaNodeFieldConstraint) getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint3 = (BetaNodeFieldConstraint) getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint4 = (BetaNodeFieldConstraint) getConstraint("cheeseType3", Operator.EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = (BetaNodeFieldConstraint) getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint1 = (BetaNodeFieldConstraint) getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    constraint3 = (BetaNodeFieldConstraint) getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    constraint4 = (BetaNodeFieldConstraint) getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = (BetaNodeFieldConstraint) getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint1 = (BetaNodeFieldConstraint) getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    constraint3 = (BetaNodeFieldConstraint) getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint4 = (BetaNodeFieldConstraint) getConstraint("cheeseType3", Operator.EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = (BetaNodeFieldConstraint) getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint1 = (BetaNodeFieldConstraint) getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint3 = (BetaNodeFieldConstraint) getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    constraint4 = (BetaNodeFieldConstraint) getConstraint("cheeseType3", Operator.EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
}
Also used : BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) Test(org.junit.Test)

Example 32 with BetaNodeFieldConstraint

use of org.drools.core.spi.BetaNodeFieldConstraint in project drools by kiegroup.

the class QuadroupleBetaConstraintsTest method testOneIndxed.

@Test
public void testOneIndxed() {
    BetaNodeFieldConstraint constraint0 = getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint1 = getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint3 = getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint4 = getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint[] constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint1 = getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    constraint3 = getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint4 = getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint1 = getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint3 = getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    constraint4 = getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint1 = getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint3 = getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint4 = getConstraint("cheeseType3", Operator.EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
}
Also used : Cheese(org.drools.core.test.model.Cheese) BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) Test(org.junit.Test)

Example 33 with BetaNodeFieldConstraint

use of org.drools.core.spi.BetaNodeFieldConstraint in project drools by kiegroup.

the class QuadroupleBetaConstraintsTest method testThreeIndxed.

@Test
public void testThreeIndxed() {
    BetaNodeFieldConstraint constraint0 = getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint1 = getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint3 = getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint4 = getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint[] constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    constraint1 = getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    constraint3 = getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint4 = getConstraint("cheeseType3", Operator.EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    constraint1 = getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint3 = getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    constraint4 = getConstraint("cheeseType3", Operator.EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
    constraint0 = getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    constraint1 = getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    constraint3 = getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    constraint4 = getConstraint("cheeseType3", Operator.EQUAL, "type", Cheese.class);
    constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
}
Also used : Cheese(org.drools.core.test.model.Cheese) BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) Test(org.junit.Test)

Example 34 with BetaNodeFieldConstraint

use of org.drools.core.spi.BetaNodeFieldConstraint in project drools by kiegroup.

the class QuadroupleBetaConstraintsTest method testNoneIndxed.

@Test
public void testNoneIndxed() {
    BetaNodeFieldConstraint constraint0 = getConstraint("cheeseType0", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint1 = getConstraint("cheeseType1", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint3 = getConstraint("cheeseType2", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint4 = getConstraint("cheeseType3", Operator.NOT_EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint[] constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3, constraint4 };
    checkBetaConstraints(constraints, QuadroupleBetaConstraints.class);
}
Also used : BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) Test(org.junit.Test)

Example 35 with BetaNodeFieldConstraint

use of org.drools.core.spi.BetaNodeFieldConstraint in project drools by kiegroup.

the class TripleBetaConstraintsTest method testThreeIndxed.

@Test
public void testThreeIndxed() {
    BetaNodeFieldConstraint constraint0 = getConstraint("cheeseType0", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint1 = getConstraint("cheeseType1", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint constraint3 = getConstraint("cheeseType2", Operator.EQUAL, "type", Cheese.class);
    BetaNodeFieldConstraint[] constraints = new BetaNodeFieldConstraint[] { constraint0, constraint1, constraint3 };
    checkBetaConstraints(constraints, TripleBetaConstraints.class);
}
Also used : BetaNodeFieldConstraint(org.drools.core.spi.BetaNodeFieldConstraint) Test(org.junit.Test)

Aggregations

BetaNodeFieldConstraint (org.drools.core.spi.BetaNodeFieldConstraint)43 Test (org.junit.Test)28 MvelConstraint (org.drools.core.rule.constraint.MvelConstraint)8 IndexableConstraint (org.drools.core.rule.IndexableConstraint)7 Cheese (org.drools.core.test.model.Cheese)6 ArrayList (java.util.ArrayList)5 Constraint (org.drools.core.spi.Constraint)5 BetaConstraints (org.drools.core.common.BetaConstraints)4 MutableTypeConstraint (org.drools.core.rule.MutableTypeConstraint)4 RuleBaseConfiguration (org.drools.core.RuleBaseConfiguration)3 BetaMemory (org.drools.core.reteoo.BetaMemory)3 AlphaNodeFieldConstraint (org.drools.core.spi.AlphaNodeFieldConstraint)3 TupleIndexHashTable (org.drools.core.util.index.TupleIndexHashTable)3 TupleList (org.drools.core.util.index.TupleList)3 List (java.util.List)2 InternalFactHandle (org.drools.core.common.InternalFactHandle)2 SingleBetaConstraints (org.drools.core.common.SingleBetaConstraints)2 TupleStartEqualsConstraint (org.drools.core.common.TupleStartEqualsConstraint)2 InternalKnowledgeBase (org.drools.core.impl.InternalKnowledgeBase)2 AccumulateNode (org.drools.core.reteoo.AccumulateNode)2