Class FinishedByEvaluatorDefinition

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

public class FinishedByEvaluatorDefinition extends Object implements EvaluatorDefinition

The implementation of the finishedby evaluator definition.

The finishedby evaluator correlates two events and matches when the current event start timestamp happens before the correlated event start timestamp, but both end timestamps occur at the same time. This is the symmetrical opposite of finishes evaluator.

Lets look at an example:

$eventA : EventA( this finishedby $eventB )

The previous pattern will match if and only if the $eventA starts before $eventB starts and finishes at the same time $eventB finishes. In other words:

 
 $eventA.startTimestamp < $eventB.startTimestamp &&
 $eventA.endTimestamp == $eventB.endTimestamp 
 

The finishedby evaluator accepts one optional parameter. If it is defined, it determines the maximum distance between the end timestamp of both events in order for the operator to match. Example:

$eventA : EventA( this finishedby[ 5s ] $eventB )
Will match if and only if:
 
 $eventA.startTimestamp < $eventB.startTimestamp &&
 abs( $eventA.endTimestamp - $eventB.endTimestamp ) <= 5s
 

NOTE: it makes no sense to use a negative interval value for the parameter and the engine will raise an exception if that happens.

See Also: