Class StartsEvaluatorDefinition

  • All Implemented Interfaces:
    Externalizable, Serializable, org.drools.compiler.rule.builder.EvaluatorDefinition, org.kie.api.runtime.rule.EvaluatorDefinition

    public class StartsEvaluatorDefinition
    extends Object
    implements org.drools.compiler.rule.builder.EvaluatorDefinition

    The implementation of the starts evaluator definition.

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

    Lets look at an example:

    $eventA : EventA( this starts $eventB )

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

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

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

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

    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:
    Serialized Form
    • Field Detail

      • startsOp

        protected static final String startsOp
      • STARTS

        public static final org.drools.drl.parser.impl.Operator STARTS
      • STARTS_NOT

        public static final org.drools.drl.parser.impl.Operator STARTS_NOT
    • Constructor Detail

      • StartsEvaluatorDefinition

        public StartsEvaluatorDefinition()
    • Method Detail

      • getEvaluator

        public org.drools.core.rule.accessor.Evaluator getEvaluator​(org.drools.core.base.ValueType type,
                                                                    org.drools.drl.parser.impl.Operator operator)
        Specified by:
        getEvaluator in interface org.drools.compiler.rule.builder.EvaluatorDefinition
      • getEvaluator

        public org.drools.core.rule.accessor.Evaluator getEvaluator​(org.drools.core.base.ValueType type,
                                                                    org.drools.drl.parser.impl.Operator operator,
                                                                    String parameterText)
        Specified by:
        getEvaluator in interface org.drools.compiler.rule.builder.EvaluatorDefinition
      • getEvaluator

        public org.drools.core.rule.accessor.Evaluator getEvaluator​(org.drools.core.base.ValueType type,
                                                                    String operatorId,
                                                                    boolean isNegated,
                                                                    String parameterText)
        Specified by:
        getEvaluator in interface org.drools.compiler.rule.builder.EvaluatorDefinition
      • getEvaluator

        public org.drools.core.rule.accessor.Evaluator getEvaluator​(org.drools.core.base.ValueType type,
                                                                    String operatorId,
                                                                    boolean isNegated,
                                                                    String parameterText,
                                                                    org.drools.compiler.rule.builder.EvaluatorDefinition.Target left,
                                                                    org.drools.compiler.rule.builder.EvaluatorDefinition.Target right)
        Specified by:
        getEvaluator in interface org.drools.compiler.rule.builder.EvaluatorDefinition
      • getEvaluatorIds

        public String[] getEvaluatorIds()
        Specified by:
        getEvaluatorIds in interface org.drools.compiler.rule.builder.EvaluatorDefinition
      • isNegatable

        public boolean isNegatable()
        Specified by:
        isNegatable in interface org.drools.compiler.rule.builder.EvaluatorDefinition
      • getTarget

        public org.drools.compiler.rule.builder.EvaluatorDefinition.Target getTarget()
        Specified by:
        getTarget in interface org.drools.compiler.rule.builder.EvaluatorDefinition
      • supportsType

        public boolean supportsType​(org.drools.core.base.ValueType type)
        Specified by:
        supportsType in interface org.drools.compiler.rule.builder.EvaluatorDefinition