Package org.evrete.api
Interface EvaluatorsContext
-
- All Known Subinterfaces:
Knowledge,RuleSession<S>,RuleSetContext<C,R>,RuntimeContext<C>,StatefulSession,StatelessSession
public interface EvaluatorsContextA collection of every condition tha was ever used in the engine's runtime. It allows developers to register an
Evaluatorand use itsEvaluatorHandleto later update the supplied condition.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default EvaluatorHandleaddEvaluator(Evaluator evaluator)EvaluatorHandleaddEvaluator(Evaluator evaluator, double complexity)Registers new condition evaluator and returns its handle.EvaluatorgetEvaluator(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 Detail
-
addEvaluator
EvaluatorHandle addEvaluator(Evaluator evaluator, double complexity)
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
Evaluator getEvaluator(EvaluatorHandle handle)
Returns evaluator by its handle.
- Parameters:
handle- evaluator handle- Returns:
- existing condition evaluator or null if such condition does not exist
-
addEvaluator
default EvaluatorHandle addEvaluator(Evaluator evaluator)
- Parameters:
evaluator- condition to add- Returns:
- new
EvaluatorHandleor the one of an existing condition. - See Also:
addEvaluator(Evaluator, double)
-
replaceEvaluator
void replaceEvaluator(EvaluatorHandle handle, Evaluator newEvaluator)
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
void replaceEvaluator(EvaluatorHandle handle, ValuesPredicate predicate)
Replaces existing condition with a new one.
- Parameters:
handle- handle of an existing conditionpredicate- new condition in a form ifValuesPredicate
-
-