Class CoincidesEvaluatorDefinition
- java.lang.Object
-
- org.drools.mvel.evaluators.CoincidesEvaluatorDefinition
-
- All Implemented Interfaces:
Externalizable,Serializable,org.drools.compiler.rule.builder.EvaluatorDefinition,org.kie.api.runtime.rule.EvaluatorDefinition
public class CoincidesEvaluatorDefinition extends Object implements org.drools.compiler.rule.builder.EvaluatorDefinition
The implementation of the 'coincides' evaluator definition.
The
coincidesevaluator 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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCoincidesEvaluatorDefinition.CoincidesEvaluatorImplements the 'coincides' evaluator itself
-
Field Summary
Fields Modifier and Type Field Description static org.drools.drl.parser.impl.OperatorCOINCIDESstatic org.drools.drl.parser.impl.OperatorCOINCIDES_NOTprotected static StringcoincidesOp
-
Constructor Summary
Constructors Constructor Description CoincidesEvaluatorDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.drools.core.rule.accessor.EvaluatorgetEvaluator(org.drools.core.base.ValueType type, String operatorId, boolean isNegated, String parameterText)org.drools.core.rule.accessor.EvaluatorgetEvaluator(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)org.drools.core.rule.accessor.EvaluatorgetEvaluator(org.drools.core.base.ValueType type, org.drools.drl.parser.impl.Operator operator)org.drools.core.rule.accessor.EvaluatorgetEvaluator(org.drools.core.base.ValueType type, org.drools.drl.parser.impl.Operator operator, String parameterText)String[]getEvaluatorIds()org.drools.compiler.rule.builder.EvaluatorDefinition.TargetgetTarget()booleanisNegatable()voidreadExternal(ObjectInput in)booleansupportsType(org.drools.core.base.ValueType type)voidwriteExternal(ObjectOutput out)
-
-
-
Field Detail
-
coincidesOp
protected static final String coincidesOp
-
COINCIDES
public static final org.drools.drl.parser.impl.Operator COINCIDES
-
COINCIDES_NOT
public static final org.drools.drl.parser.impl.Operator COINCIDES_NOT
-
-
Method Detail
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
getEvaluator
public org.drools.core.rule.accessor.Evaluator getEvaluator(org.drools.core.base.ValueType type, org.drools.drl.parser.impl.Operator operator)- Specified by:
getEvaluatorin interfaceorg.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:
getEvaluatorin interfaceorg.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:
getEvaluatorin interfaceorg.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:
getEvaluatorin interfaceorg.drools.compiler.rule.builder.EvaluatorDefinition
-
getEvaluatorIds
public String[] getEvaluatorIds()
- Specified by:
getEvaluatorIdsin interfaceorg.drools.compiler.rule.builder.EvaluatorDefinition
-
isNegatable
public boolean isNegatable()
- Specified by:
isNegatablein interfaceorg.drools.compiler.rule.builder.EvaluatorDefinition
-
getTarget
public org.drools.compiler.rule.builder.EvaluatorDefinition.Target getTarget()
- Specified by:
getTargetin interfaceorg.drools.compiler.rule.builder.EvaluatorDefinition
-
supportsType
public boolean supportsType(org.drools.core.base.ValueType type)
- Specified by:
supportsTypein interfaceorg.drools.compiler.rule.builder.EvaluatorDefinition
-
-