Class MatcherNode

java.lang.Object
jadex.rules.eca.MatcherNode

public class MatcherNode extends 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 Details

  • Constructor Details

    • MatcherNode

      public MatcherNode()
  • Method Details

    • getRules

      public List<IRule<?>> getRules(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 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, 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(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(String subtype, IRule<?> rule)
      Add a rule for an event type.
      Parameters:
      subtype - The subtype.
      rule - The rule.
    • removeRule

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

      protected void putChild(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(String type)
      Get the child matcher node.
      Parameters:
      type - The event type.
      Returns:
      The child matcher.
    • internalGetRules

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

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

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