Class Step
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
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanFail()Some steps cannot fail.voiddestroy()protected StringgetActualValue(org.antlr.v4.runtime.tree.ParseTree tree, String value) booleanSome steps can even pass if there is no input provided.final voidsetNextStep(int newStepNr, Step newNextStep) voidsetVerbose(boolean newVerbose) static booleantreeIsSeparator(org.antlr.v4.runtime.tree.ParseTree tree) protected final org.antlr.v4.runtime.tree.ParseTreeup(org.antlr.v4.runtime.tree.ParseTree tree) abstract WalkList.WalkResultThis will walk into the tree and recurse through all the remaining steps.protected final WalkList.WalkResultwalkNextStep(org.antlr.v4.runtime.tree.ParseTree tree, String value)
-
Field Details
-
LOG
protected static final org.apache.logging.log4j.Logger LOG -
logprefix
-
verbose
protected boolean verbose
-
-
Constructor Details
-
Step
public Step()
-
-
Method Details
-
setVerbose
public void setVerbose(boolean newVerbose) -
destroy
public void destroy() -
setNextStep
-
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
-
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
-