Class Rule<T>

  • All Implemented Interfaces:
    IRule<T>

    public class Rule<T>
    extends java.lang.Object
    implements IRule<T>
    Implementation of a rule. Has a - name - event types it reacts to - condition, lhs of the rule - action, rhs of the rule
    • Field Detail

      • name

        protected java.lang.String name
        The rule name.
      • events

        protected java.util.List<EventType> events
        The event types.
      • condition

        protected ICondition condition
        The condition.
      • action

        protected IAction<T> action
        The action.
    • Constructor Detail

      • Rule

        public Rule​(java.lang.String name)
        Create a new rule.
      • Rule

        public Rule​(java.lang.String name,
                    ICondition condition)
        Create a new rule.
      • Rule

        public Rule​(java.lang.String name,
                    ICondition condition,
                    IAction<T> action)
        Create a new rule.
    • Method Detail

      • getName

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

        public void setName​(java.lang.String name)
        Set the name.
        Parameters:
        name - The name to set.
      • getCondition

        public ICondition getCondition()
        Get the condition.
        Specified by:
        getCondition in interface IRule<T>
        Returns:
        The condition.
      • setCondition

        public void setCondition​(ICondition condition)
        Set the condition.
        Parameters:
        condition - The condition to set.
      • getAction

        public IAction<T> getAction()
        Get the action.
        Specified by:
        getAction in interface IRule<T>
        Returns:
        The action.
      • setAction

        public void setAction​(IAction<T> action)
        Set the action.
        Parameters:
        action - The action to set.
      • setEvents

        public void setEvents​(java.util.List<EventType> events)
        Set the event types.
        Parameters:
        events - The event types.
      • setEventNames

        public void setEventNames​(java.util.List<java.lang.String> events)
        Set the event types.
        Parameters:
        events - The event types.
      • getEvents

        public java.util.List<EventType> getEvents()
        Get the event types.
        Specified by:
        getEvents in interface IRule<T>
        Returns:
        The event types.
      • addEvent

        public void addEvent​(EventType event)
        Set the event types.
        Parameters:
        events - The event types.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object