Class MatcherAction

java.lang.Object
nl.basjes.parse.useragent.analyze.MatcherAction
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MatcherExtractAction, MatcherFailIfFoundAction, MatcherRequireAction, MatcherVariableAction

public abstract class MatcherAction extends Object implements Serializable
See Also:
  • Field Details

    • matcher

      protected Matcher matcher
    • mustHaveMatches

      protected boolean mustHaveMatches
  • Constructor Details

    • MatcherAction

      public MatcherAction()
  • Method Details

    • destroy

      public void destroy()
    • setVerbose

      public final void setVerbose(boolean newVerbose, boolean temporary)
    • getMatchExpression

      public String getMatchExpression()
    • initialize

      public long initialize()
    • parseWalkerExpression

      protected abstract org.antlr.v4.runtime.ParserRuleContext parseWalkerExpression(UserAgentTreeWalkerParser parser)
    • setFixedValue

      protected abstract void setFixedValue(String newFixedValue)
    • inform

      public void inform(String key, String value, org.antlr.v4.runtime.tree.ParseTree result)
      For each key that this action wants to be notified for this method is called. Note that on a single parse event the same name CAN be called multiple times!!
      Parameters:
      key - The key of the node
      value - The value that was found
      result - The node in the parser tree where the match occurred
    • inform

      protected abstract void inform(String key, WalkList.WalkResult foundValue)
    • obtainResult

      public abstract boolean obtainResult()
      Called after all nodes have been notified.
      Returns:
      true if the obtainResult result was valid. False will fail the entire matcher this belongs to.
    • reset

      public void reset()
    • getMatches

      public MatchesList getMatches()
    • toString

      public String toString()
      Overrides:
      toString in class Object