java.lang.Object
nl.basjes.parse.useragent.analyze.treewalker.steps.Step
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
StepBackToFull, StepCleanVersion, StepConcat, StepConcatPostfix, StepConcatPrefix, StepContains, StepDefaultIfNull, StepDown, StepEndsWith, StepEquals, StepExtractBrandFromUrl, StepIsInLookupContains, StepIsInLookupPrefix, StepIsInSet, StepIsNotInLookupContains, StepIsNotInLookupPrefix, StepIsNotInSet, StepIsNull, StepIsValidVersion, StepLookup, StepLookupContains, StepLookupPrefix, StepNext, StepNextN, StepNormalizeBrand, StepNotContains, StepNotEquals, StepPrev, StepPrevN, StepReplaceString, StepSegmentRange, StepStartsWith, StepUp, StepWordRange

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

    • LOG

      protected static final org.apache.logging.log4j.Logger LOG
    • logprefix

      protected String logprefix
    • verbose

      protected boolean verbose
  • Constructor Details

    • Step

      public Step()
  • Method Details

    • setVerbose

      public void setVerbose(boolean newVerbose)
    • destroy

      public void destroy()
    • setNextStep

      public final void setNextStep(int newStepNr, Step newNextStep)
    • walkNextStep

      protected final WalkList.WalkResult walkNextStep(@Nonnull org.antlr.v4.runtime.tree.ParseTree tree, @Nullable String value)
    • up

      protected final org.antlr.v4.runtime.tree.ParseTree up(@Nonnull org.antlr.v4.runtime.tree.ParseTree tree)
    • treeIsSeparator

      public static boolean treeIsSeparator(org.antlr.v4.runtime.tree.ParseTree tree)
    • getActualValue

      protected String getActualValue(@Nonnull org.antlr.v4.runtime.tree.ParseTree tree, @Nullable String value)
    • walk

      public abstract WalkList.WalkResult walk(@Nonnull org.antlr.v4.runtime.tree.ParseTree tree, @Nullable String value)
      This will walk into the tree and recurse through all the remaining steps. This must iterate of all possibilities and return the first matching result.
      Parameters:
      tree - The tree to walk into.
      value - The string representation of the previous step (needed for compare and lookup operations). The null value means to use the implicit 'full' value (i.e. getSourceText(tree) )
      Returns:
      Either null or the actual value that was found.
    • canFail

      public boolean canFail()
      Some steps cannot fail. For a require rule if the last step cannot fail then this can be removed from the require list to improve performance at run time.
      Returns:
      If this specific step can or cannot fail.
    • mustHaveInput

      public boolean mustHaveInput()
      Some steps can even pass if there is no input provided.
      Returns:
      If this specific step needs input to pass.
    • getNextStep

      public Step getNextStep()