Interface RuleBuilder<C extends RuntimeContext<C>>
- Type Parameters:
C- the type of theRuntimeContextof the builder
- All Superinterfaces:
Environment,FluentEnvironment<Rule>,LhsFactSelector<LhsBuilder<C>>,Named,NamedType.Resolver,Rule
-
Method Summary
Modifier and TypeMethodDescriptiondefault EvaluatorHandlecreateCondition(String expression) Compiles and registers the provided predicate with the current context (aKnowledgeor aRuleSession).createCondition(String expression, double complexity) Compiles and registers the provided predicate with the current context (aKnowledgeor aRuleSession).createCondition(Predicate<Object[]> predicate, double complexity, String... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).createCondition(Predicate<Object[]> predicate, double complexity, FieldReference... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).default EvaluatorHandlecreateCondition(Predicate<Object[]> predicate, String... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).default EvaluatorHandlecreateCondition(Predicate<Object[]> predicate, FieldReference... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).createCondition(ValuesPredicate predicate, double complexity, String... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).createCondition(ValuesPredicate predicate, double complexity, FieldReference... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).default EvaluatorHandlecreateCondition(ValuesPredicate predicate, String... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).default EvaluatorHandlecreateCondition(ValuesPredicate predicate, FieldReference... references) Registers the provided predicate with the current context (aKnowledgeor aRuleSession).getLhs()Returns the LhsBuilder instance.Returns the runtime context of this rule builder.<Z> RuleBuilder<C>Sets a property of the RuleBuilder instance.salience(int salience) Sets the salience of the rule.Methods inherited from interface org.evrete.api.Environment
get, get, getPropertyNamesMethods inherited from interface org.evrete.api.FluentEnvironment
setMethods inherited from interface org.evrete.api.LhsFactSelector
forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEach, forEachMethods inherited from interface org.evrete.api.NamedType.Resolver
getDeclaredFactTypes, resolveMethods inherited from interface org.evrete.api.Rule
chainRhs, getRhs, getSalience, setName, setRhs, setRhs, setSalience
-
Method Details
-
getLhs
LhsBuilder<C> getLhs()Returns the LhsBuilder instance.- Returns:
- the LhsBuilder instance
-
salience
Sets the salience of the rule.- Parameters:
salience- the salience value of the rule- Returns:
- a RuleBuilder instance
-
property
Sets a property of the RuleBuilder instance.- Type Parameters:
Z- the type of the property value- Parameters:
property- the name of the propertyvalue- the value of the property- Returns:
- a RuleBuilder instance
-
getRuntime
C getRuntime()Returns the runtime context of this rule builder.- Returns:
- the runtime object
-
createCondition
Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
predicate- condition predicatereferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
predicate- condition predicatereferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
default EvaluatorHandle createCondition(Predicate<Object[]> predicate, FieldReference... references) Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or used in theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace existing conditions on the fly.- Parameters:
predicate- condition predicatereferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
predicate- condition predicatereferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
Compiles and registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
expression- literal conditioncomplexity- condition's relative complexity- Returns:
- evaluator handle
- Throws:
CompilationException- if the engine fails to compile the expression- See Also:
-
createCondition
Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
predicate- condition predicatecomplexity- condition's relative complexityreferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
EvaluatorHandle createCondition(Predicate<Object[]> predicate, double complexity, String... references) Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
predicate- condition predicatecomplexity- condition's relative complexityreferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
EvaluatorHandle createCondition(ValuesPredicate predicate, double complexity, FieldReference... references) Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
predicate- condition predicatecomplexity- condition's relative complexityreferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
EvaluatorHandle createCondition(Predicate<Object[]> predicate, double complexity, FieldReference... references) Registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
predicate- condition predicatecomplexity- condition's relative complexityreferences- field references- Returns:
- evaluator handle
- See Also:
-
createCondition
Compiles and registers the provided predicate with the current context (a
Knowledgeor aRuleSession). The resultingEvaluatorHandlecan later be used in theLhsBuilder.where(EvaluatorHandle...)code blocks, shared among other rules (if appropriate), or provided to theEvaluatorsContext.replaceEvaluator(EvaluatorHandle, Evaluator)andEvaluatorsContext.replaceEvaluator(EvaluatorHandle, ValuesPredicate)methods to replace conditions on the fly.- Parameters:
expression- literal condition- Returns:
- evaluator handle
- Throws:
CompilationException- if the engine fails to compile the expression- See Also:
-