Class UnitRuleGroup

  • All Implemented Interfaces:
    java.lang.Comparable<Rule>, Rule

    public class UnitRuleGroup
    extends CompositeRule
    A unit rule group is a composite rule that acts as a unit: Either all rules are applied or nothing is applied (all or nothing semantic). This class is not thread-safe.
    • Constructor Detail

      • UnitRuleGroup

        public UnitRuleGroup()
        Create a unit rule group.
      • UnitRuleGroup

        public UnitRuleGroup​(java.lang.String name)
        Create a unit rule group.
        Parameters:
        name - of the composite rule
      • UnitRuleGroup

        public UnitRuleGroup​(java.lang.String name,
                             java.lang.String description)
        Create a unit rule group.
        Parameters:
        name - of the composite rule
        description - of the composite rule
      • UnitRuleGroup

        public UnitRuleGroup​(java.lang.String name,
                             java.lang.String description,
                             int priority)
        Create a unit rule group.
        Parameters:
        name - of the composite rule
        description - of the composite rule
        priority - of the composite rule
    • Method Detail

      • evaluate

        public boolean evaluate​(Facts facts)
        Description copied from class: BasicRule
        This method implements the rule's condition(s). Implementations should handle any runtime exception and return true/false accordingly
        Specified by:
        evaluate in interface Rule
        Specified by:
        evaluate in class CompositeRule
        Returns:
        true if the rule should be applied given the provided facts, false otherwise
      • execute

        public void execute​(Facts facts)
                     throws java.lang.Exception
        Description copied from class: BasicRule
        This method implements the rule's action(s).
        Specified by:
        execute in interface Rule
        Specified by:
        execute in class CompositeRule
        Throws:
        java.lang.Exception - thrown if an exception occurs when performing action(s)