Class FinishesEvaluatorDefinition

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

public class FinishesEvaluatorDefinition extends Object implements EvaluatorDefinition

The implementation of the finishes evaluator definition.

The finishes evaluator correlates two events and matches when the current event's start timestamp happens after the correlated event's start timestamp, but both end timestamps occur at the same time.

Lets look at an example:

$eventA : EventA( this finishes $eventB )

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

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

The finishes 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 finishes[ 5s ] $eventB )
Will match if and only if:
 
 $eventB.startTimestamp < $eventA.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: