Package org.evrete.api
Interface EvaluatorsContext
- All Known Subinterfaces:
Knowledge,RuleSession<S>,RuleSetContext<C,,R> RuntimeContext<C>,StatefulSession,StatelessSession
public interface EvaluatorsContext
A collection of every condition tha was ever used in the engine's runtime. It allows developers
to register an Evaluator and use its EvaluatorHandle to later update the supplied
condition.
-
Method Summary
Modifier and TypeMethodDescriptiondefault EvaluatorHandleaddEvaluator(Evaluator evaluator) addEvaluator(Evaluator evaluator, double complexity) Registers new condition evaluator and returns its handle.getEvaluator(EvaluatorHandle handle) Returns evaluator by its handle.voidreplaceEvaluator(EvaluatorHandle handle, Evaluator newEvaluator) Replaces existing condition with a new one.voidreplaceEvaluator(EvaluatorHandle handle, ValuesPredicate predicate) Replaces existing condition with a new one.
-
Method Details
-
addEvaluator
Registers new condition evaluator and returns its handle. If an existing
Evaluatormatches the argument (Evaluator.compare(Evaluator)returnsEvaluator.RELATION_EQUALS), the existing evaluator handle will be returned instead and no changes will be made in the context.- Parameters:
evaluator- condition to addcomplexity- condition's relative complexity- Returns:
- new
EvaluatorHandleor the one of an existing condition.
-
getEvaluator
Returns evaluator by its handle.
- Parameters:
handle- evaluator handle- Returns:
- existing condition evaluator or null if such condition does not exist
-
addEvaluator
- Parameters:
evaluator- condition to add- Returns:
- new
EvaluatorHandleor the one of an existing condition. - See Also:
-
replaceEvaluator
Replaces existing condition with a new one. New condition must have the same
Evaluator.descriptor(), otherwiseIllegalArgumentExceptionwill be thrown.- Parameters:
handle- handle of an existing conditionnewEvaluator- new condition- Throws:
IllegalArgumentException- if no condition can be found by the given handle or if the existing condition's descriptor does not match the new one.
-
replaceEvaluator
Replaces existing condition with a new one.
- Parameters:
handle- handle of an existing conditionpredicate- new condition in a form ifValuesPredicate
-