public interface EvaluatorsContext
A context that maintains a collection of every condition used in the engine's runtime.
This interface allows developers to register an
ValuesPredicate and use its
EvaluatorHandle to later update the supplied condition or subscribe to condition evaluation events.
The context adheres to the context separation principle, i.e., changes made to a
Knowledge-level context are propagated down to each spawned RuleSession, but not vice versa.
-
Method Summary
Modifier and TypeMethodDescriptionvoidforEach(BiConsumer<EvaluatorHandle, ValuesPredicate> listener) Executes the specified action for each Evaluator with its corresponding handle.getPredicate(EvaluatorHandle handle) Returns evaluator by its handle.publisher(EvaluatorHandle handle) Creates or returns an existing publisher for a condition with the provided handle.voidreplacePredicate(EvaluatorHandle handle, ValuesPredicate newPredicate) Replaces an existing condition with a new one.
-
Method Details
-
getPredicate
Returns evaluator by its handle.
- Parameters:
handle- evaluator handle- Returns:
- existing condition predicate or null if such condition does not exist
-
publisher
Creates or returns an existing publisher for a condition with the provided handle.- Parameters:
handle- the evaluator handle- Returns:
- a publisher of evaluation results
-
forEach
Executes the specified action for each Evaluator with its corresponding handle.- Parameters:
listener- The action to be performed.
-
replacePredicate
Replaces an existing condition with a new one. This method does not check the signature which may result in unpredictable results when applied incorrectly.- Parameters:
handle- the handle of an existing conditionnewPredicate- the new condition in the form of aValuesPredicate
-