Class CoincidesEvaluatorDefinition

java.lang.Object
org.drools.mvel.evaluators.CoincidesEvaluatorDefinition
All Implemented Interfaces:
Externalizable, Serializable, EvaluatorDefinition, EvaluatorDefinition

public class CoincidesEvaluatorDefinition extends Object implements EvaluatorDefinition

The implementation of the 'coincides' evaluator definition.

The coincides evaluator correlates two events and matches when both happen at the same time. Optionally, the evaluator accept thresholds for the distance between events' start and finish timestamps.

Lets look at an example:

$eventA : EventA( this coincides $eventB )

The previous pattern will match if and only if the start timestamps of both $eventA and $eventB are the same AND the end timestamp of both $eventA and $eventB also are the same.

Optionally, this operator accepts one or two parameters. These parameters are the thresholds for the distance between matching timestamps. If only one paratemer is given, it is used for both start and end timestamps. If two parameters are given, then the first is used as a threshold for the start timestamp and the second one is used as a threshold for the end timestamp. In other words:

 $eventA : EventA( this coincides[15s, 10s] $eventB ) 
Above pattern will match if and only if:
 abs( $eventA.startTimestamp - $eventB.startTimestamp ) <= 15s &&
 abs( $eventA.endTimestamp - $eventB.endTimestamp ) <= 10s 
 

NOTE: it makes no sense to use negative interval values for the parameters and the engine will raise an error if that happens.

See Also: