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
,StepIsNotInLookupPrefix
,StepIsNotInSet
,StepIsNull
,StepLookup
,StepLookupContains
,StepLookupPrefix
,StepNext
,StepNextN
,StepNormalizeBrand
,StepNotEquals
,StepPrev
,StepPrevN
,StepReplaceString
,StepSegmentRange
,StepStartsWith
,StepUp
,StepWordRange
public abstract class Step extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Step()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canFail()
Some steps cannot fail.void
destroy()
protected String
getActualValue(org.antlr.v4.runtime.tree.ParseTree tree, String value)
Step
getNextStep()
boolean
mustHaveInput()
Some steps can even pass if there is no input provided.void
setNextStep(int newStepNr, Step newNextStep)
void
setVerbose(boolean newVerbose)
static boolean
treeIsSeparator(org.antlr.v4.runtime.tree.ParseTree tree)
protected org.antlr.v4.runtime.tree.ParseTree
up(org.antlr.v4.runtime.tree.ParseTree tree)
abstract WalkList.WalkResult
walk(org.antlr.v4.runtime.tree.ParseTree tree, String value)
This will walk into the tree and recurse through all the remaining steps.protected WalkList.WalkResult
walkNextStep(org.antlr.v4.runtime.tree.ParseTree tree, String value)
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
logprefix
protected String logprefix
-
verbose
protected boolean verbose
-
-
Method Detail
-
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(org.antlr.v4.runtime.tree.ParseTree tree, String value)
-
up
protected final org.antlr.v4.runtime.tree.ParseTree up(org.antlr.v4.runtime.tree.ParseTree tree)
-
treeIsSeparator
public static boolean treeIsSeparator(org.antlr.v4.runtime.tree.ParseTree tree)
-
getActualValue
protected String getActualValue(org.antlr.v4.runtime.tree.ParseTree tree, String value)
-
walk
public abstract WalkList.WalkResult walk(org.antlr.v4.runtime.tree.ParseTree tree, 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()
-
-