Class MatcherNode


  • public class MatcherNode
    extends java.lang.Object
    The matcher node is the base class for event based rule matching. The task is to deliver the set of rules that needs to be checked against the event.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​MatcherNode> children
      The map of child matcher nodes.
      protected java.util.Map<java.lang.String,​java.util.List<IRule<?>>> rules
      The directly managed rule sets.
    • Constructor Summary

      Constructors 
      Constructor Description
      MatcherNode()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addRule​(EventType type, IRule<?> rule, int i)
      Add a rule for event at a level.
      void addRule​(IRule<?> rule)
      Add a rule to the matcher.
      protected void addRule​(java.lang.String subtype, IRule<?> rule)
      Add a rule for an event type.
      protected MatcherNode getChild​(java.lang.String type)
      Get the child matcher node.
      protected MatcherNode getOrCreateMatcherNode​(java.lang.String subtype)
      Get or create a matcher child node.
      java.util.List<IRule<?>> getRules​(EventType type)
      Get the rules for an event type.
      protected void getRules​(EventType type, int i, java.util.List<IRule<?>> ret)
      Get the rules for an event type at level i.
      java.util.List<IRule<?>> getRules​(java.lang.String type)
      Get the rules for an event type (as string, delim is .)
      protected java.util.List<IRule<?>> internalGetRules​(java.lang.String type)
      Get the directly stored rules of a matcher.
      static void main​(java.lang.String[] args)
      Main only for testing.
      protected void putChild​(java.lang.String type, MatcherNode node)
      Add a child matcher node per given subtype.
      protected void removeRule​(EventType type, IRule<?> rule, int i)
      Remove a rule for event from a level.
      void removeRule​(IRule<?> rule)
      Remove a rule from the matcher.
      protected void removeRule​(java.lang.String subtype, IRule<?> rule)
      Remove a rule for an event type.
      java.lang.String toString()
      Get the string representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • children

        protected java.util.Map<java.lang.String,​MatcherNode> children
        The map of child matcher nodes.
      • rules

        protected java.util.Map<java.lang.String,​java.util.List<IRule<?>>> rules
        The directly managed rule sets.
    • Constructor Detail

      • MatcherNode

        public MatcherNode()
    • Method Detail

      • getRules

        public java.util.List<IRule<?>> getRules​(java.lang.String type)
        Get the rules for an event type (as string, delim is .)
        Parameters:
        type - The event type.
        Returns:
        The list of rules relevant for the event type.
      • getRules

        public java.util.List<IRule<?>> getRules​(EventType type)
        Get the rules for an event type.
        Parameters:
        type - The event type.
        Returns:
        The list of rules relevant for the event type.
      • addRule

        public void addRule​(IRule<?> rule)
        Add a rule to the matcher.
        Parameters:
        rule - The rule.
      • removeRule

        public void removeRule​(IRule<?> rule)
        Remove a rule from the matcher.
        Parameters:
        rule - The rule.
      • getRules

        protected void getRules​(EventType type,
                                int i,
                                java.util.List<IRule<?>> ret)
        Get the rules for an event type at level i.
        Parameters:
        type - The event type.
        i - The level.
      • addRule

        protected void addRule​(EventType type,
                               IRule<?> rule,
                               int i)
        Add a rule for event at a level.
        Parameters:
        type - The event type.
        rule - The rule.
        i - The level.
      • removeRule

        protected void removeRule​(EventType type,
                                  IRule<?> rule,
                                  int i)
        Remove a rule for event from a level.
        Parameters:
        type - The event type.
        rule - The rule.
        i - The level.
      • getOrCreateMatcherNode

        protected MatcherNode getOrCreateMatcherNode​(java.lang.String subtype)
        Get or create a matcher child node.
        Parameters:
        subtype - The event string for the child matcher.
        Returns:
        The child matcher.
      • addRule

        protected void addRule​(java.lang.String subtype,
                               IRule<?> rule)
        Add a rule for an event type.
        Parameters:
        subtype - The subtype.
        rule - The rule.
      • removeRule

        protected void removeRule​(java.lang.String subtype,
                                  IRule<?> rule)
        Remove a rule for an event type.
        Parameters:
        subtype - The subtype.
        rule - The rule.
      • putChild

        protected void putChild​(java.lang.String type,
                                MatcherNode node)
        Add a child matcher node per given subtype.
        Parameters:
        type - The event type.
        node - The matcher node.
      • getChild

        protected MatcherNode getChild​(java.lang.String type)
        Get the child matcher node.
        Parameters:
        type - The event type.
        Returns:
        The child matcher.
      • internalGetRules

        protected java.util.List<IRule<?>> internalGetRules​(java.lang.String type)
        Get the directly stored rules of a matcher.
        Parameters:
        type - The event type.
        Returns:
        The list of rules.
      • toString

        public java.lang.String toString()
        Get the string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation.
      • main

        public static void main​(java.lang.String[] args)
        Main only for testing.