Package org.drools.core.spi
Interface Evaluator
-
- All Superinterfaces:
org.kie.api.runtime.rule.Evaluator
,Serializable
- All Known Implementing Classes:
AfterEvaluatorDefinition.AfterEvaluator
,BaseEvaluator
,BeforeEvaluatorDefinition.BeforeEvaluator
,CoincidesEvaluatorDefinition.CoincidesEvaluator
,DuringEvaluatorDefinition.DuringEvaluator
,EvaluatorWrapper
,FinishedByEvaluatorDefinition.FinishedByEvaluator
,FinishesEvaluatorDefinition.FinishesEvaluator
,IncludesEvaluatorDefinition.IncludesEvaluator
,MatchesEvaluatorsDefinition.StringMatchesEvaluator
,MatchesEvaluatorsDefinition.StringNotMatchesEvaluator
,MeetsEvaluatorDefinition.MeetsEvaluator
,MetByEvaluatorDefinition.MetByEvaluator
,OverlappedByEvaluatorDefinition.OverlappedByEvaluator
,OverlapsEvaluatorDefinition.OverlapsEvaluator
,PointInTimeEvaluator
,SetEvaluatorsDefinition.ArrayContainsEvaluator
,SetEvaluatorsDefinition.ArrayExcludesEvaluator
,SetEvaluatorsDefinition.BaseMemberOfEvaluator
,SetEvaluatorsDefinition.BaseNotMemberOfEvaluator
,SetEvaluatorsDefinition.BigDecimalMemberOfEvaluator
,SetEvaluatorsDefinition.BigDecimalNotMemberOfEvaluator
,SetEvaluatorsDefinition.BigIntegerMemberOfEvaluator
,SetEvaluatorsDefinition.BigIntegerNotMemberOfEvaluator
,SetEvaluatorsDefinition.BooleanMemberOfEvaluator
,SetEvaluatorsDefinition.BooleanNotMemberOfEvaluator
,SetEvaluatorsDefinition.ByteMemberOfEvaluator
,SetEvaluatorsDefinition.ByteNotMemberOfEvaluator
,SetEvaluatorsDefinition.CharacterMemberOfEvaluator
,SetEvaluatorsDefinition.CharacterNotMemberOfEvaluator
,SetEvaluatorsDefinition.DateMemberOfEvaluator
,SetEvaluatorsDefinition.DateNotMemberOfEvaluator
,SetEvaluatorsDefinition.DoubleMemberOfEvaluator
,SetEvaluatorsDefinition.DoubleNotMemberOfEvaluator
,SetEvaluatorsDefinition.FloatMemberOfEvaluator
,SetEvaluatorsDefinition.FloatNotMemberOfEvaluator
,SetEvaluatorsDefinition.IntegerMemberOfEvaluator
,SetEvaluatorsDefinition.IntegerNotMemberOfEvaluator
,SetEvaluatorsDefinition.LongMemberOfEvaluator
,SetEvaluatorsDefinition.LongNotMemberOfEvaluator
,SetEvaluatorsDefinition.ObjectContainsEvaluator
,SetEvaluatorsDefinition.ObjectExcludesEvaluator
,SetEvaluatorsDefinition.ObjectMemberOfEvaluator
,SetEvaluatorsDefinition.ObjectNotMemberOfEvaluator
,SetEvaluatorsDefinition.ShortMemberOfEvaluator
,SetEvaluatorsDefinition.ShortNotMemberOfEvaluator
,SetEvaluatorsDefinition.StringMemberOfEvaluator
,SetEvaluatorsDefinition.StringNotMemberOfEvaluator
,SoundslikeEvaluatorsDefinition.StringNotSoundsLikeEvaluator
,SoundslikeEvaluatorsDefinition.StringSoundsLikeEvaluator
,StartedByEvaluatorDefinition.StartedByEvaluator
,StartsEvaluatorDefinition.StartsEvaluator
,StrEvaluatorDefinition.StrEvaluator
public interface Evaluator extends Serializable, org.kie.api.runtime.rule.Evaluator
A public interface to be implemented by all evaluators
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
evaluate(InternalWorkingMemory workingMemory, InternalReadAccessor extractor, InternalFactHandle factHandle, FieldValue value)
Evaluates the expression using the provided parameters.boolean
evaluate(InternalWorkingMemory workingMemory, InternalReadAccessor leftExtractor, InternalFactHandle left, InternalReadAccessor rightExtractor, InternalFactHandle right)
Evaluates the expression using the provided parameters.boolean
evaluateCachedLeft(InternalWorkingMemory workingMemory, VariableRestriction.VariableContextEntry context, InternalFactHandle right)
Evaluates the expression using the provided parameters.boolean
evaluateCachedRight(InternalWorkingMemory workingMemory, VariableRestriction.VariableContextEntry context, InternalFactHandle left)
Evaluates the expression using the provided parameters.ValueType
getCoercedValueType()
Returns the value type this evaluator will coerce operands to, during evaluation.Interval
getInterval()
In case this is a temporal evaluator, returns the interval in which this evaluator may match the target factorg.kie.api.runtime.rule.Operator
getOperator()
Returns the operator representation object for this evaluatorValueType
getValueType()
Returns the type of the values this evaluator operates upon.boolean
isTemporal()
Returns true if this evaluator implements a temporal evaluation, i.e., a time sensitive evaluation whose properties of matching only events within an specific time interval can be used for determining event expirations automatically.
-
-
-
Method Detail
-
getValueType
ValueType getValueType()
Returns the type of the values this evaluator operates upon.- Returns:
-
getOperator
org.kie.api.runtime.rule.Operator getOperator()
Returns the operator representation object for this evaluator- Specified by:
getOperator
in interfaceorg.kie.api.runtime.rule.Evaluator
- Returns:
-
getCoercedValueType
ValueType getCoercedValueType()
Returns the value type this evaluator will coerce operands to, during evaluation. This is useful for operators like "memberOf", that always convert to Object when evaluating, independently of the source operand value type.- Returns:
-
evaluate
boolean evaluate(InternalWorkingMemory workingMemory, InternalReadAccessor extractor, InternalFactHandle factHandle, FieldValue value)
Evaluates the expression using the provided parameters. This method is used when evaluating alpha-constraints, i.e., a fact attribute against a constant value. For instance: Person( name == "Bob" ) So, it uses a constant value "Bob" that is sent into the method as the FieldValue (value), and compares it to the value of the name field, read by using the extractor on the fact instance (object1).- Parameters:
workingMemory
- The current working memoryextractor
- The extractor used to get the field value from the objectfactHandle
- The source object to evaluate, i.e., the factvalue
- The actual value to compare to, i.e., the constant value.- Returns:
- Returns true if evaluation is successful. false otherwise.
-
evaluate
boolean evaluate(InternalWorkingMemory workingMemory, InternalReadAccessor leftExtractor, InternalFactHandle left, InternalReadAccessor rightExtractor, InternalFactHandle right)
Evaluates the expression using the provided parameters. This method is used for internal indexing and hashing, when drools needs to extract and evaluate both left and right values at once. For instance: Person( name == $someName ) This method will be used to extract and evaluate both the "name" attribute and the "$someName" variable at once.- Parameters:
workingMemory
- The current working memoryleftExtractor
- The extractor to read the left value. In the above example, the "$someName" variable value.left
- The source object from where the value of the variable is extracted.rightExtractor
- The extractor to read the right value. In the above example, the "name" attribute value.right
- The right object from where to extract the value. In the above example, that is the "Person" instance from where to extract the "name" attribute.- Returns:
- Returns true if evaluation is successful. false otherwise.
-
evaluateCachedLeft
boolean evaluateCachedLeft(InternalWorkingMemory workingMemory, VariableRestriction.VariableContextEntry context, InternalFactHandle right)
Evaluates the expression using the provided parameters. This method is used when evaluating left-activated beta-constraints, i.e., a fact attribute against a variable value, that is activated from the left. For instance: Person( name == $someName ) This method will be used when a new $someName variable is bound. So it will cache the value of $someName and will iterate over the right memory (Person instances) evaluating each occurrence.- Parameters:
workingMemory
- The current working memorycontext
- The previously cached context, including the left value and the extractor for the right value.right
- The right object, from where to extract the value. In the above example, that is the "Person" instance from where to extract the "name" attribute.- Returns:
- Returns true if evaluation is successful. false otherwise.
-
evaluateCachedRight
boolean evaluateCachedRight(InternalWorkingMemory workingMemory, VariableRestriction.VariableContextEntry context, InternalFactHandle left)
Evaluates the expression using the provided parameters. This method is used when evaluating right-activated beta-constraints, i.e., a fact attribute against a variable value, that is activated from the right. For instance: Person( name == $someName ) This method will be used when a new Person instance is evaluated. So it will cache the value of the "Person" instance and will iterate over the left memory comparing it to each "$someName" bound values.- Parameters:
workingMemory
- The current working memorycontext
- The previously cached context, including the right value and the extractor for the left value.left
- The left object, from where to extract the bound variable. In the above example, that is the "$someName" variable value.- Returns:
- Returns true if evaluation is successful. false otherwise.
-
isTemporal
boolean isTemporal()
Returns true if this evaluator implements a temporal evaluation, i.e., a time sensitive evaluation whose properties of matching only events within an specific time interval can be used for determining event expirations automatically.- Specified by:
isTemporal
in interfaceorg.kie.api.runtime.rule.Evaluator
- Returns:
- true if the evaluator is a temporal evaluator.
-
getInterval
Interval getInterval()
In case this is a temporal evaluator, returns the interval in which this evaluator may match the target fact- Returns:
-
-