- All Superinterfaces:
Environment,Named,NamedType.Resolver
- All Known Subinterfaces:
RuleBuilder<C>,RuleDescriptor,RuntimeRule
Base interface for each rule in the engine.
Provides mechanisms for getting and setting rule characteristics and behavior.
-
Method Summary
Modifier and TypeMethodDescriptionvoidchainRhs(Consumer<RhsContext> consumer) Chains a consumer to the current RHS logic.getRhs()Gets the RHS (Right Hand Side) logic as a Consumer.intRetrieves the rule's salience.voidSets a new name for the rule.voidSets the RHS logic using a literal string.voidsetRhs(Consumer<RhsContext> rhs) Sets the RHS logic using a Consumer.voidsetSalience(int value) Sets the rule's salience.Methods inherited from interface org.evrete.api.Environment
get, get, getPropertyNames, setMethods inherited from interface org.evrete.api.NamedType.Resolver
getDeclaredFactTypes, resolve
-
Method Details
-
getRhs
Consumer<RhsContext> getRhs()Gets the RHS (Right Hand Side) logic as a Consumer.- Returns:
- the RHS logic consumer.
-
setRhs
Sets the RHS logic using a literal string. The literal will be compiled and converted into a Consumer.- Parameters:
literalRhs- the string representation of RHS logic.
-
setRhs
Sets the RHS logic using a Consumer. Can be null.- Parameters:
rhs- the RHS logic consumer.
-
getSalience
int getSalience()Retrieves the rule's salience.- Returns:
- the salience value.
-
setSalience
void setSalience(int value) Sets the rule's salience.- Parameters:
value- the salience value to set.
-
chainRhs
Chains a consumer to the current RHS logic. The provided consumer is executed after the current RHS.- Parameters:
consumer- the consumer to chain.
-
setName
Sets a new name for the rule.- Parameters:
newName- the new name to give to the rule.
-