Class Rulebase

  • All Implemented Interfaces:
    IRulebase, java.lang.Cloneable

    public class Rulebase
    extends java.lang.Object
    implements IRulebase
    The rule base of the system containing all rules.
    • Field Detail

      • rules

        protected java.util.Set rules
        The rules.
      • listeners

        protected java.util.List listeners
        The listeners.
    • Constructor Detail

      • Rulebase

        public Rulebase()
        Create a new rulebase.
    • Method Detail

      • addRule

        public void addRule​(IRule rule)
        Add a rule.
        Specified by:
        addRule in interface IRulebase
        Parameters:
        rule - The rule to add.
      • removeRule

        public void removeRule​(IRule rule)
        Remove a rule.
        Specified by:
        removeRule in interface IRulebase
        Parameters:
        rule - The rule to remove.
      • getRules

        public java.util.Collection getRules()
        Get all rules.
        Specified by:
        getRules in interface IRulebase
        Returns:
        All rules.
      • getRule

        public IRule getRule​(java.lang.String name)
        Get a rule with a given name.
        Specified by:
        getRule in interface IRulebase
        Parameters:
        name - The rule name.
        Returns:
        The rule.
      • clone

        public java.lang.Object clone()
        Clone this object.
        Specified by:
        clone in interface IRulebase
        Overrides:
        clone in class java.lang.Object
        Returns:
        A clone of this object.
      • getUniqueRuleName

        public static java.lang.String getUniqueRuleName​(IRulebase rb,
                                                         java.lang.String rulename)
        Get a unique rulename for a given rulename.
        Parameters:
        rb - The rulebase.
        rulename - The rulename.
        Returns:
        The (possibly modified) rulename.