public void test_constraint_unsatisfied() { var seqabinputs = new List <AbstractEvent>(createPrimitiveEvents("A")); seqabinputs.Add(new PrimitiveEvent("B")); var seqabs = getOutputListFromInputList("[SEQ(A,B),[A,B],n(B)]", seqabinputs); Assert.Equal(1, seqabs.Count); var seqacinputs = new List <AbstractEvent>(createPrimitiveEvents("A")); seqacinputs.Add(new PrimitiveEvent("C")); var seqacs = getOutputListFromInputList("[SEQ(A,C),[A,C],n(B)]", seqacinputs); Assert.Equal(1, seqacs.Count); var c = new EqualIDWhenEqualEventTypeConstraint(new EventType("A")); Assert.False(PrimitiveBufferComponentAnyMatchConstraint.checkAll(new List <PrimitiveBufferComponentAnyMatchConstraint>() { c }, seqacs[0], seqabs)); Assert.False(PrimitiveBufferComponentAnyMatchConstraint.checkAll(new List <PrimitiveBufferComponentAnyMatchConstraint>() { c }, seqabs[0], seqacs)); }
public bool testGuardConditions(AbstractEvent candidate, IEnumerable <AbstractEvent> eventBuffer) { if (!candidate.type.Equals(requiredEventType)) { return(false); } if (eventBuffer == null) { eventBuffer = Enumerable.Empty <AbstractEvent>(); } if (!PrimitiveBufferComponentAnyMatchConstraint.checkAll(pBCAnyMatchConstraints, candidate, eventBuffer)) { return(false); } if (!PrimitiveBufferComponentAllMatchConstraint.checkAll(pBCAllMatchConstraints, candidate, eventBuffer)) { return(false); } foreach (var item in bufferConstraints) { if (!item.check(candidate, eventBuffer)) { return(false); } } return(true); }