use of org.drools.core.common.EventFactHandle in project drools by kiegroup.
the class TemporalEvaluatorFactoryTest method testCoincides.
@Test
public void testCoincides() {
registry.addEvaluatorDefinition(CoincidesEvaluatorDefinition.class.getName());
EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 3, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle bar = new EventFactHandle(2, "bar", 1, 2, 3, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle drool = new EventFactHandle(1, "drool", 1, 2, 2, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle mole = new EventFactHandle(1, "mole", 1, 1, 2, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
final Object[][] data = { { foo, "coincides", bar, Boolean.TRUE }, { foo, "coincides", drool, Boolean.FALSE }, { foo, "coincides", mole, Boolean.FALSE }, { drool, "coincides", mole, Boolean.FALSE }, { foo, "not coincides", bar, Boolean.FALSE }, { foo, "not coincides", drool, Boolean.TRUE }, { foo, "not coincides", mole, Boolean.TRUE }, { drool, "not coincides", mole, Boolean.TRUE }, { foo, "coincides[1]", bar, Boolean.TRUE }, { foo, "coincides[1]", drool, Boolean.TRUE }, { foo, "coincides[2]", mole, Boolean.TRUE }, { foo, "coincides[1]", mole, Boolean.FALSE }, { drool, "coincides[1]", mole, Boolean.TRUE }, { foo, "not coincides[1]", bar, Boolean.FALSE }, { foo, "not coincides[1]", drool, Boolean.FALSE }, { foo, "not coincides[2]", mole, Boolean.FALSE }, { foo, "not coincides[1]", mole, Boolean.TRUE }, { drool, "not coincides[1]", mole, Boolean.FALSE }, { foo, "coincides[1,2]", bar, Boolean.TRUE }, { foo, "coincides[0,1]", drool, Boolean.TRUE }, { foo, "coincides[1,0]", drool, Boolean.FALSE }, { foo, "coincides[1,2]", mole, Boolean.TRUE }, { foo, "coincides[1,1]", mole, Boolean.FALSE }, { drool, "coincides[1,1]", mole, Boolean.TRUE }, { drool, "coincides[0,1]", mole, Boolean.FALSE }, { foo, "not coincides[1,2]", bar, Boolean.FALSE }, { foo, "not coincides[0,1]", drool, Boolean.FALSE }, { foo, "not coincides[1,0]", drool, Boolean.TRUE }, { foo, "not coincides[1,2]", mole, Boolean.FALSE }, { foo, "not coincides[1,1]", mole, Boolean.TRUE }, { drool, "not coincides[1,1]", mole, Boolean.FALSE }, { drool, "not coincides[0,1]", mole, Boolean.TRUE } };
runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
use of org.drools.core.common.EventFactHandle in project drools by kiegroup.
the class TemporalEvaluatorFactoryTest method testStarts.
@Test
public void testStarts() {
registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle bar = new EventFactHandle(2, "bar", 1, 2, 7, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle drool = new EventFactHandle(1, "drool", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle mole = new EventFactHandle(1, "mole", 1, 1, 4, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
final Object[][] data = { { bar, "starts", foo, Boolean.TRUE }, { drool, "starts", foo, Boolean.FALSE }, { mole, "starts", foo, Boolean.FALSE }, { foo, "starts", bar, Boolean.FALSE }, { bar, "not starts", foo, Boolean.FALSE }, { drool, "not starts", foo, Boolean.TRUE }, { mole, "not starts", foo, Boolean.TRUE }, { foo, "not starts", bar, Boolean.TRUE }, { bar, "starts[1]", foo, Boolean.TRUE }, { drool, "starts[1]", foo, Boolean.FALSE }, { mole, "starts[1]", foo, Boolean.TRUE }, { foo, "starts[1]", bar, Boolean.FALSE }, { bar, "not starts[1]", foo, Boolean.FALSE }, { drool, "not starts[1]", foo, Boolean.TRUE }, { mole, "not starts[1]", foo, Boolean.FALSE }, { foo, "not starts[1]", bar, Boolean.TRUE }, { mole, "starts[3]", foo, Boolean.TRUE } };
runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
use of org.drools.core.common.EventFactHandle in project drools by kiegroup.
the class TemporalEvaluatorFactoryTest method testOverlaps.
@Test
public void testOverlaps() {
registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 8, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle bar = new EventFactHandle(2, "bar", 1, 7, 7, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle drool = new EventFactHandle(1, "drool", 1, 11, 5, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle mole = new EventFactHandle(1, "mole", 1, 5, 5, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
final Object[][] data = { { foo, "overlaps", bar, Boolean.TRUE }, { foo, "overlaps", drool, Boolean.FALSE }, { foo, "overlaps", mole, Boolean.FALSE }, { foo, "not overlaps", bar, Boolean.FALSE }, { foo, "not overlaps", drool, Boolean.TRUE }, { foo, "not overlaps", mole, Boolean.TRUE }, { foo, "overlaps[3]", bar, Boolean.TRUE }, { foo, "overlaps[3]", drool, Boolean.FALSE }, { foo, "overlaps[3]", mole, Boolean.FALSE }, { foo, "overlaps[2]", bar, Boolean.FALSE }, { foo, "overlaps[6]", mole, Boolean.FALSE }, { foo, "not overlaps[3]", bar, Boolean.FALSE }, { foo, "not overlaps[3]", drool, Boolean.TRUE }, { foo, "not overlaps[3]", mole, Boolean.TRUE }, { foo, "not overlaps[2]", bar, Boolean.TRUE }, { foo, "not overlaps[6]", mole, Boolean.TRUE }, { foo, "overlaps[1,3]", bar, Boolean.TRUE }, { foo, "overlaps[1,3]", drool, Boolean.FALSE }, { foo, "overlaps[1,3]", mole, Boolean.FALSE }, { foo, "overlaps[4,6]", bar, Boolean.FALSE }, { foo, "overlaps[1,8]", mole, Boolean.FALSE }, { foo, "not overlaps[1,3]", bar, Boolean.FALSE }, { foo, "not overlaps[1,3]", drool, Boolean.TRUE }, { foo, "not overlaps[1,3]", mole, Boolean.TRUE }, { foo, "not overlaps[4,6]", bar, Boolean.TRUE }, { foo, "not overlaps[1,8]", mole, Boolean.TRUE } };
runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
use of org.drools.core.common.EventFactHandle in project drools by kiegroup.
the class TemporalEvaluatorFactoryTest method testBefore.
@Test
public void testBefore() {
registry.addEvaluatorDefinition(BeforeEvaluatorDefinition.class.getName());
EventFactHandle foo = new EventFactHandle(1, "foo", 1, 1, 2, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle bar = new EventFactHandle(2, "bar", 1, 2, 2, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle drool = new EventFactHandle(1, "drool", 1, 5, 3, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
final Object[][] data = { { foo, "before", drool, Boolean.TRUE }, { foo, "before", bar, Boolean.FALSE }, { drool, "before", foo, Boolean.FALSE }, { drool, "before", bar, Boolean.FALSE }, { bar, "before", drool, Boolean.TRUE }, { bar, "before", foo, Boolean.FALSE }, { foo, "not before", drool, Boolean.FALSE }, { foo, "not before", bar, Boolean.TRUE }, { drool, "not before", foo, Boolean.TRUE }, { drool, "not before", bar, Boolean.TRUE }, { bar, "not before", drool, Boolean.FALSE }, { bar, "not before", foo, Boolean.TRUE }, { foo, "before[2]", drool, Boolean.TRUE }, { foo, "before[3]", drool, Boolean.FALSE }, { foo, "before[-1]", bar, Boolean.TRUE }, { foo, "before[-2]", bar, Boolean.TRUE }, { bar, "before[1]", drool, Boolean.TRUE }, { bar, "before[2]", drool, Boolean.FALSE }, { bar, "before[-3]", foo, Boolean.TRUE }, { bar, "before[-2]", foo, Boolean.FALSE }, { drool, "before[-6]", bar, Boolean.TRUE }, { drool, "before[-5]", bar, Boolean.FALSE }, { drool, "before[-7]", foo, Boolean.TRUE }, { drool, "before[-8]", foo, Boolean.TRUE }, { foo, "not before[2]", drool, Boolean.FALSE }, { foo, "not before[3]", drool, Boolean.TRUE }, { foo, "not before[-1]", bar, Boolean.FALSE }, { foo, "not before[-2]", bar, Boolean.FALSE }, { bar, "not before[1]", drool, Boolean.FALSE }, { bar, "not before[2]", drool, Boolean.TRUE }, { bar, "not before[-3]", foo, Boolean.FALSE }, { bar, "not before[-2]", foo, Boolean.TRUE }, { drool, "not before[-6]", bar, Boolean.FALSE }, { drool, "not before[-5]", bar, Boolean.TRUE }, { drool, "not before[-7]", foo, Boolean.FALSE }, { drool, "not before[-8]", foo, Boolean.FALSE }, { foo, "before[2,4]", drool, Boolean.TRUE }, { foo, "before[3,4]", drool, Boolean.FALSE }, { foo, "before[-1,1]", bar, Boolean.TRUE }, { foo, "before[0,-2]", bar, Boolean.TRUE }, { bar, "before[0,4]", drool, Boolean.TRUE }, { bar, "before[2,4]", drool, Boolean.FALSE }, { bar, "before[-4,0]", foo, Boolean.TRUE }, { bar, "before[-2,0]", foo, Boolean.FALSE }, { drool, "before[-6,-3]", bar, Boolean.TRUE }, { drool, "before[-5,-3]", bar, Boolean.FALSE }, { drool, "before[-7,-4]", foo, Boolean.TRUE }, { drool, "before[-6,-4]", foo, Boolean.FALSE }, { foo, "not before[2,4]", drool, Boolean.FALSE }, { foo, "not before[3,4]", drool, Boolean.TRUE }, { foo, "not before[-1,1]", bar, Boolean.FALSE }, { foo, "not before[0,-2]", bar, Boolean.FALSE }, { bar, "not before[0,4]", drool, Boolean.FALSE }, { bar, "not before[2,4]", drool, Boolean.TRUE }, { bar, "not before[-4,0]", foo, Boolean.FALSE }, { bar, "not before[-2,0]", foo, Boolean.TRUE }, { drool, "not before[-6,-3]", bar, Boolean.FALSE }, { drool, "not before[-5,-3]", bar, Boolean.TRUE }, { drool, "not before[-7,-4]", foo, Boolean.FALSE }, { drool, "not before[-6,-4]", foo, Boolean.TRUE } };
runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
use of org.drools.core.common.EventFactHandle in project drools by kiegroup.
the class TemporalEvaluatorFactoryTest method testFinishes.
@Test
public void testFinishes() {
registry.addEvaluatorDefinition(DuringEvaluatorDefinition.class.getName());
EventFactHandle foo = new EventFactHandle(1, "foo", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle bar = new EventFactHandle(2, "bar", 1, 5, 7, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle drool = new EventFactHandle(1, "drool", 1, 2, 10, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
EventFactHandle mole = new EventFactHandle(1, "mole", 1, 7, 6, new DisconnectedWorkingMemoryEntryPoint("DEFAULT"));
final Object[][] data = { { bar, "finishes", foo, Boolean.TRUE }, { drool, "finishes", foo, Boolean.FALSE }, { mole, "finishes", foo, Boolean.FALSE }, { foo, "finishes", bar, Boolean.FALSE }, { bar, "not finishes", foo, Boolean.FALSE }, { drool, "not finishes", foo, Boolean.TRUE }, { mole, "not finishes", foo, Boolean.TRUE }, { foo, "not finishes", bar, Boolean.TRUE }, { bar, "finishes[1]", foo, Boolean.TRUE }, { drool, "finishes[1]", foo, Boolean.FALSE }, { mole, "finishes[1]", foo, Boolean.TRUE }, { foo, "finishes[1]", bar, Boolean.FALSE }, { bar, "not finishes[1]", foo, Boolean.FALSE }, { drool, "not finishes[1]", foo, Boolean.TRUE }, { mole, "not finishes[1]", foo, Boolean.FALSE }, { foo, "not finishes[1]", bar, Boolean.TRUE }, { mole, "finishes[3]", foo, Boolean.TRUE } };
runEvaluatorTest(data, ValueType.OBJECT_TYPE);
}
Aggregations