Interface EvaluatorsContext


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 Details

    • getPredicate

      ValuesPredicate getPredicate(EvaluatorHandle handle)

      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

      void forEach(BiConsumer<EvaluatorHandle,ValuesPredicate> listener)
      Executes the specified action for each Evaluator with its corresponding handle.
      Parameters:
      listener - The action to be performed.
    • replacePredicate

      void replacePredicate(EvaluatorHandle handle, ValuesPredicate newPredicate)
      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 condition
      newPredicate - the new condition in the form of a ValuesPredicate