Module org.evrete.core
Package org.evrete.api.builders
Interface LhsBuilder<C extends RuntimeContext<C>>
- Type Parameters:
C- the type of theRuntimeContextof the builder
public interface LhsBuilder<C extends RuntimeContext<C>>
The LhsBuilder interface is used to build the left-hand side (LHS) of a rule.
-
Method Summary
Modifier and TypeMethodDescriptiondefault LhsBuilder<C>A shorthand and fluent version of theaddFactDeclaration(String, Class)method.default LhsBuilder<C>A shorthand and fluent version of theaddFactDeclaration(String, String)method.default LhsBuilder<C>A shorthand and fluent version of theaddFactDeclaration(String, Type)method.addFactDeclaration(String name, Class<?> type) Adds a fact declaration to the current LhsBuilder.addFactDeclaration(String name, String type) Adds a fact declaration to the current LhsBuilder.addFactDeclaration(String name, Type<?> type) Adds a fact declaration to the current LhsBuilder.execute()Terminates current rule builder as a rule without action.Terminates current rule builder with the provided RHS actionexecute(Consumer<RhsContext> consumer) Terminates current rule builder with the provided RHS actiondefault LhsBuilder<C>Adds one or more condition expressions to the currentLhsBuilder.Adds a condition expression to the current LhsBuilder.Adds a condition to the currentLhsBuilderwith the provided predicate, complexity, and references.default LhsBuilder<C>Adds a condition to the currentLhsBuilderwith the provided predicate, default complexity, and references.where(ValuesPredicate predicate, double complexity, String... references) Adds a condition to the currentLhsBuilderwith the provided predicate, complexity, and field references.default LhsBuilder<C>where(ValuesPredicate predicate, String... references) Adds a condition to the currentLhsBuilderwith the provided predicate and field references.
-
Method Details
-
execute
Terminates current rule builder with the provided RHS action
- Parameters:
literalRhs- RHS action as Java code- Returns:
- returns the current ruleset builder
-
execute
RuleSetBuilder<C> execute()Terminates current rule builder as a rule without action.
- Returns:
- returns the current ruleset builder
-
execute
Terminates current rule builder with the provided RHS action
- Parameters:
consumer- RHS- Returns:
- returns the current ruleset builder
-
where
Adds one or more condition expressions to the currentLhsBuilder.- Parameters:
expressions- the condition expressions to add- Returns:
- the current
LhsBuilder
-
where
Adds a condition expression to the current LhsBuilder.- Parameters:
expression- the condition expression to addcomplexity- the complexity of the condition expression- Returns:
- the current
LhsBuilder
-
where
Adds a condition to the currentLhsBuilderwith the provided predicate, complexity, and references.- Parameters:
predicate- the predicate to add as a conditioncomplexity- the complexity of the conditionreferences- the field references, e.g.,["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate- Returns:
- the current
LhsBuilder
-
where
Adds a condition to the currentLhsBuilderwith the provided predicate, default complexity, and references.- Parameters:
predicate- the predicate to add as a conditionreferences- the field references, e.g.,["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate- Returns:
- the current
LhsBuilder
-
where
Adds a condition to the currentLhsBuilderwith the provided predicate, complexity, and field references.- Parameters:
predicate- the predicate to add as a conditioncomplexity- the complexity of the conditionreferences- the field references, e.g.,["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate- Returns:
- the current
LhsBuilder
-
where
Adds a condition to the currentLhsBuilderwith the provided predicate and field references.- Parameters:
predicate- the predicate to add as a conditionreferences- the field references, e.g.,["$a.id", "$b.code.value", "$c"], in the same order and of the same types as required by the predicate- Returns:
- the current
LhsBuilder
-
addFact
A shorthand and fluent version of theaddFactDeclaration(String, String)method.- Parameters:
name- the name of the fact declaration, e.g. "$customer"type- the logical type of the fact, see theTypedocumentation on the logical types- Returns:
- this builder
-
addFactDeclaration
Adds a fact declaration to the current LhsBuilder. -
addFact
A shorthand and fluent version of theaddFactDeclaration(String, Type)method.- Parameters:
name- the name of the fact declaration, e.g. "$customer"type- the type of the fact declaration- Returns:
- this builder
-
addFactDeclaration
Adds a fact declaration to the current LhsBuilder.- Parameters:
name- the name of the fact declaration, e.g. "$customer"type- the type of the fact declaration- Returns:
- the NamedType representing the fact declaration
- Throws:
NullPointerException- if either the name or type parameter is null
-
addFact
A shorthand and fluent version of theaddFactDeclaration(String, Class)method.- Parameters:
name- the name of the fact declaration, e.g. "$customer"type- the type of the fact declaration- Returns:
- this builder
-
addFactDeclaration
Adds a fact declaration to the current LhsBuilder.- Parameters:
name- the name of the fact declaration, e.g. "$customer"type- the type of the fact declaration- Returns:
- the
NamedTyperepresenting the fact declaration
-