Class Rule

  • All Implemented Interfaces:
    IRule

    public class Rule
    extends java.lang.Object
    implements IRule
    A rule consists of a condition part and an action part that gets executed when the rule triggers.
    • Field Detail

      • name

        protected java.lang.String name
        The name.
      • condition

        protected ICondition condition
        The condition.
      • action

        protected IAction action
        The action.
    • Constructor Detail

      • Rule

        public Rule​(java.lang.String name,
                    ICondition condition,
                    IAction action)
        Create a new rule.
        Parameters:
        name - The name.
        condition - The condition.
        action - The action.
      • Rule

        public Rule​(java.lang.String name,
                    ICondition condition,
                    IAction action,
                    IPriorityEvaluator priority)
        Create a new rule.
        Parameters:
        name - The name.
        condition - The condition.
        action - The action.
    • Method Detail

      • getCondition

        public ICondition getCondition()
        Get the condition.
        Specified by:
        getCondition in interface IRule
        Returns:
        The condition.
      • getAction

        public IAction getAction()
        Get the action.
        Specified by:
        getAction in interface IRule
        Returns:
        The action.
      • getName

        public java.lang.String getName()
        Get the rule name.
        Specified by:
        getName in interface IRule
        Returns:
        The rule name.
      • hashCode

        public int hashCode()
        Compute the hash code.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code.
      • equals

        public boolean equals​(java.lang.Object obj)
        Test for equality.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object.
        Returns:
        True, if this object equals obj.
      • toString

        public java.lang.String toString()
        Create a string representation of the rule.
        Overrides:
        toString in class java.lang.Object