Interface Rule

All Superinterfaces:
Environment, FluentEnvironment<Rule>, Named, NamedType.Resolver
All Known Subinterfaces:
RuleBuilder<C>, RuleBuilder<C>, RuleDescriptor, RuntimeRule
All Known Implementing Classes:
AbstractRule

public interface Rule extends FluentEnvironment<Rule>, Named, NamedType.Resolver
Base interface for each rule in the engine. Provides mechanisms for getting and setting rule characteristics and behavior.
  • Method Details

    • getRhs

      Consumer<RhsContext> getRhs()
      Gets the RHS (Right Hand Side) logic as a Consumer.
      Returns:
      the RHS logic consumer.
    • setRhs

      void setRhs(String literalRhs)
      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

      void setRhs(Consumer<RhsContext> rhs)
      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

      void chainRhs(Consumer<RhsContext> consumer)
      Chains a consumer to the current RHS logic. The provided consumer is executed after the current RHS.
      Parameters:
      consumer - the consumer to chain.
    • setName

      void setName(String newName)
      Sets a new name for the rule.
      Parameters:
      newName - the new name to give to the rule.