Class WalkerFactory
java.lang.Object
org.loboevolution.apache.xpath.axes.WalkerFactory
This class is both a factory for XPath location path expressions, which are built from the opcode
map output, and an analysis engine for the location path expressions in order to provide
optimization hints.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intBit is on if any of the walkers contain an ancestor step.static final intBit is on if any of the walkers contain an ancestor-or-self step.static final intFound "//foo" patternstatic final intBit is on if any of the walkers contain an attribute step.static final intBit is on if any of the walkers contain a child step.static final intBit is on if any of the walkers contain a descendant step.static final intBit is on if any of the walkers contain a descendant-or-self step.static final intBit is on if any of the walkers contain a filter (i.e. id(), extension function, etc.) step.static final intBit is on if any of the walkers contain a following step.static final intBit is on if any of the walkers contain a following-sibiling step.static final intBit is on if the expression is a match pattern.static final intBit is on if any of the walkers contain a namespace step.static final intBit is on if any of the walkers contain an node() test.static final intBit is on if any of the walkers contain a parent step.static final intBit is on if any of the walkers contain a preceding step.static final intBit is on if any of the walkers contain a preceding-sibling step.static final intBit is on if the expression contains a top-level predicate.static final intBit is on if any of the walkers contain a root step.static final intBit is on if any of the walkers contain a self step.static final intFirst 8 bits are the number of top-level location steps. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanCrissCross(int analysis) static booleancanSkipSubtrees(int analysis) static voiddiagnoseIterator(String name, int analysis, Compiler compiler) static intgetAnalysisBitFromAxes(int axis) Get a corresponding BIT_XXX from an axis.static StringgetAnalysisString(int analysis) static intgetAxisFromStep(Compiler compiler, int stepOpCodePos) Special purpose function to see if we can optimize the pattern for a DescendantIterator.static intgetStepCount(int analysis) static booleanhasPredicate(int analysis) static booleanisAbsolute(int analysis) static booleanisDownwardAxisOfMany(int axis) Tell if the given axis goes downword.static booleanisOneStep(int analysis) static booleanisSet(int analysis, int bits) static booleanisWild(int analysis) static booleanmightBeProximate(Compiler compiler, int opPos, int stepType) Tell if the predicates need to have proximity knowledge.static DTMIteratornewDTMIterator(Compiler compiler, int opPos, boolean isTopLevel) Create a new LocPathIterator iterator.static booleanwalksAttributes(int analysis) static booleanwalksChildren(int analysis) static booleanwalksChildrenAndExtraAndSelfOnly(int analysis) static booleanwalksChildrenOnly(int analysis) static booleanwalksDescendants(int analysis) static booleanwalksDescendantsAndExtraAndSelfOnly(int analysis) static booleanwalksDownOnly(int analysis) static booleanwalksExtraNodes(int analysis) static booleanwalksExtraNodesOnly(int analysis) static booleanwalksFilteredList(int analysis) static booleanwalksFollowingOnlyMaybeAbsolute(int analysis) static booleanwalksInDocOrder(int analysis) static booleanwalksNamespaces(int analysis) static booleanwalksSelfOnly(int analysis) static booleanwalksSideways(int analysis) static booleanwalksSubtree(int analysis) static booleanwalksSubtreeOnlyMaybeAbsolute(int analysis) static booleanwalksUp(int analysis) static booleanwalksUpOnly(int analysis)
-
Field Details
-
BITS_COUNT
public static final int BITS_COUNTFirst 8 bits are the number of top-level location steps. Hopefully there will never be more that 255 location steps!!!- See Also:
-
BIT_PREDICATE
public static final int BIT_PREDICATEBit is on if the expression contains a top-level predicate.- See Also:
-
BIT_ANCESTOR
public static final int BIT_ANCESTORBit is on if any of the walkers contain an ancestor step.- See Also:
-
BIT_ANCESTOR_OR_SELF
public static final int BIT_ANCESTOR_OR_SELFBit is on if any of the walkers contain an ancestor-or-self step.- See Also:
-
BIT_ATTRIBUTE
public static final int BIT_ATTRIBUTEBit is on if any of the walkers contain an attribute step.- See Also:
-
BIT_CHILD
public static final int BIT_CHILDBit is on if any of the walkers contain a child step.- See Also:
-
BIT_DESCENDANT
public static final int BIT_DESCENDANTBit is on if any of the walkers contain a descendant step.- See Also:
-
BIT_DESCENDANT_OR_SELF
public static final int BIT_DESCENDANT_OR_SELFBit is on if any of the walkers contain a descendant-or-self step.- See Also:
-
BIT_FOLLOWING
public static final int BIT_FOLLOWINGBit is on if any of the walkers contain a following step.- See Also:
-
BIT_FOLLOWING_SIBLING
public static final int BIT_FOLLOWING_SIBLINGBit is on if any of the walkers contain a following-sibiling step.- See Also:
-
BIT_NAMESPACE
public static final int BIT_NAMESPACEBit is on if any of the walkers contain a namespace step.- See Also:
-
BIT_PARENT
public static final int BIT_PARENTBit is on if any of the walkers contain a parent step.- See Also:
-
BIT_PRECEDING
public static final int BIT_PRECEDINGBit is on if any of the walkers contain a preceding step.- See Also:
-
BIT_PRECEDING_SIBLING
public static final int BIT_PRECEDING_SIBLINGBit is on if any of the walkers contain a preceding-sibling step.- See Also:
-
BIT_SELF
public static final int BIT_SELFBit is on if any of the walkers contain a self step.- See Also:
-
BIT_FILTER
public static final int BIT_FILTERBit is on if any of the walkers contain a filter (i.e. id(), extension function, etc.) step.- See Also:
-
BIT_ROOT
public static final int BIT_ROOTBit is on if any of the walkers contain a root step.- See Also:
-
BIT_ANY_DESCENDANT_FROM_ROOT
public static final int BIT_ANY_DESCENDANT_FROM_ROOTFound "//foo" pattern- See Also:
-
BIT_NODETEST_ANY
public static final int BIT_NODETEST_ANYBit is on if any of the walkers contain an node() test. This is really only useful if the count is 1.- See Also:
-
BIT_MATCH_PATTERN
public static final int BIT_MATCH_PATTERNBit is on if the expression is a match pattern.- See Also:
-
-
Constructor Details
-
WalkerFactory
public WalkerFactory()
-
-
Method Details
-
isSet
public static boolean isSet(int analysis, int bits) -
diagnoseIterator
-
newDTMIterator
public static DTMIterator newDTMIterator(Compiler compiler, int opPos, boolean isTopLevel) throws TransformerException Create a new LocPathIterator iterator. The exact type of iterator returned is based on an analysis of the XPath operations.- Parameters:
compiler- non-null reference to compiler object that has processed the XPath operations into an opcode map.opPos- The position of the operation code for this itterator.- Returns:
- non-null reference to a LocPathIterator or derivative.
- Throws:
TransformerException- if any
-
getAxisFromStep
Special purpose function to see if we can optimize the pattern for a DescendantIterator.- Parameters:
compiler- non-null reference to compiler object that has processed the XPath operations into an opcode map.stepOpCodePos- The opcode position for the step.- Returns:
- 32 bits as an integer that give information about the location path as a whole.
-
getAnalysisBitFromAxes
public static int getAnalysisBitFromAxes(int axis) Get a corresponding BIT_XXX from an axis.- Parameters:
axis- One of Axis.ANCESTOR, etc.- Returns:
- One of BIT_ANCESTOR, etc.
-
mightBeProximate
public static boolean mightBeProximate(Compiler compiler, int opPos, int stepType) throws TransformerException Tell if the predicates need to have proximity knowledge.- Throws:
TransformerException
-
isDownwardAxisOfMany
public static boolean isDownwardAxisOfMany(int axis) Tell if the given axis goes downword. Bogus name, if you can think of a better one, please do tell. This really has to do with inverting attribute axis.- Parameters:
axis- One of Axis.XXX.- Returns:
- true if the axis is not a child axis and does not go up from the axis root.
-
getAnalysisString
-
hasPredicate
public static boolean hasPredicate(int analysis) -
isWild
public static boolean isWild(int analysis) -
walksAttributes
public static boolean walksAttributes(int analysis) -
walksNamespaces
public static boolean walksNamespaces(int analysis) -
walksChildren
public static boolean walksChildren(int analysis) -
walksDescendants
public static boolean walksDescendants(int analysis) -
walksSubtree
public static boolean walksSubtree(int analysis) -
walksSubtreeOnlyMaybeAbsolute
public static boolean walksSubtreeOnlyMaybeAbsolute(int analysis) -
walksFilteredList
public static boolean walksFilteredList(int analysis) -
walksInDocOrder
public static boolean walksInDocOrder(int analysis) -
walksFollowingOnlyMaybeAbsolute
public static boolean walksFollowingOnlyMaybeAbsolute(int analysis) -
walksUp
public static boolean walksUp(int analysis) -
walksSideways
public static boolean walksSideways(int analysis) -
walksExtraNodes
public static boolean walksExtraNodes(int analysis) -
walksExtraNodesOnly
public static boolean walksExtraNodesOnly(int analysis) -
isAbsolute
public static boolean isAbsolute(int analysis) -
walksChildrenOnly
public static boolean walksChildrenOnly(int analysis) -
walksChildrenAndExtraAndSelfOnly
public static boolean walksChildrenAndExtraAndSelfOnly(int analysis) -
walksDescendantsAndExtraAndSelfOnly
public static boolean walksDescendantsAndExtraAndSelfOnly(int analysis) -
walksSelfOnly
public static boolean walksSelfOnly(int analysis) -
walksUpOnly
public static boolean walksUpOnly(int analysis) -
walksDownOnly
public static boolean walksDownOnly(int analysis) -
canSkipSubtrees
public static boolean canSkipSubtrees(int analysis) -
canCrissCross
public static boolean canCrissCross(int analysis) -
isOneStep
public static boolean isOneStep(int analysis) -
getStepCount
public static int getStepCount(int analysis)
-