Class AxesWalker
java.lang.Object
org.loboevolution.apache.xpath.Expression
org.loboevolution.apache.xpath.patterns.NodeTest
org.loboevolution.apache.xpath.axes.PredicatedNodeTest
org.loboevolution.apache.xpath.axes.AxesWalker
- All Implemented Interfaces:
Cloneable
,SourceLocator
,PathComponent
,SubContextList
,ExpressionNode
,XPathVisitable
- Direct Known Subclasses:
FilterExprWalker
,ReverseAxesWalker
Serves as common interface for axes Walkers, and stores common state variables.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final int
The traversal axis from where the nodes will be filtered.protected AxesWalker
The next walker in the location step chain.protected DTMAxisTraverser
The DTM inner traversal class, that corresponds to the super axis.Fields inherited from class org.loboevolution.apache.xpath.axes.PredicatedNodeTest
m_foundLast, m_lpi, m_predCount, m_proximityPositions
Fields inherited from class org.loboevolution.apache.xpath.patterns.NodeTest
m_name, m_whatToShow, SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, WILD
-
Constructor Summary
ConstructorDescriptionAxesWalker
(LocPathIterator locPathIterator, int axis) Construct an AxesWalker using a LocPathIterator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
callVisitors
(XPathVisitor visitor) This will traverse the hierarchy, calling the visitor for each member.clone()
boolean
deepEquals
(Expression expr) Compare this object with another object and see if they are equal, include the sub heararchy.void
detach()
Detaches the walker from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.int
Get the analysis bits for this path component, as defined in the WalkerFactory.int
getAxis()
Returns the axis being iterated, if it is known.getDTM
(int node) Get the DTM for this walker.int
getLastPos
(XPathContext xctxt) Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the last index position.protected int
Get the next node in document order on the axes.Get the next walker in the location step chain.int
getRoot()
The root node of the TreeWalker, as specified in setRoot(int root).void
Initialize an AxesWalker during the parse of the XPath expression.int
nextNode()
Moves theTreeWalker
to the next visible node in document order relative to the current node, and returns the new node.void
setNextWalker
(AxesWalker walker) Set the next walker in the location step chain.void
setPrevWalker
(AxesWalker walker) Set or clear the previous walker reference in the location step chain.void
setRoot
(int root) Set the root node of the TreeWalker.final WalkingIterator
wi()
Methods inherited from class org.loboevolution.apache.xpath.axes.PredicatedNodeTest
acceptNode, callPredicateVisitors, canTraverseOutsideSubtree, countProximityPosition, getPredicate, getPredicateCount, getProximityPosition, getProximityPosition, getProximityPosition, initPredicateInfo, initProximityPosition, isReverseAxes, nodeToString, resetProximityPositions, setLocPathIterator, setPredicateCount
Methods inherited from class org.loboevolution.apache.xpath.patterns.NodeTest
calcScore, execute, execute, execute, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, getWhatToShow, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShow
Methods inherited from class org.loboevolution.apache.xpath.Expression
asIterator, asNode, assertion, bool, error, execute, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isSameClass, isStableNumber, num
-
Field Details
-
m_nextWalker
The next walker in the location step chain. -
m_axis
protected final int m_axisThe traversal axis from where the nodes will be filtered. -
m_traverser
The DTM inner traversal class, that corresponds to the super axis.
-
-
Constructor Details
-
AxesWalker
Construct an AxesWalker using a LocPathIterator.- Parameters:
locPathIterator
- non-null reference to the parent iterator.
-
-
Method Details
-
wi
-
init
Initialize an AxesWalker during the parse of the XPath expression.- Parameters:
compiler
- The Compiler object that has information about this walker in the op map.opPos
- The op code position of this location step.stepType
- The type of location step.- Throws:
TransformerException
- if any
-
clone
- Overrides:
clone
in classPredicatedNodeTest
- Throws:
CloneNotSupportedException
-
detach
public void detach()Detaches the walker from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. -
getRoot
public int getRoot()The root node of the TreeWalker, as specified in setRoot(int root). Note that this may actually be below the current node.- Returns:
- The context node of the step.
-
getAnalysisBits
public int getAnalysisBits()Get the analysis bits for this path component, as defined in the WalkerFactory.- Specified by:
getAnalysisBits
in interfacePathComponent
- Returns:
- One of WalkerFactory#BIT_DESCENDANT, etc.
-
setRoot
public void setRoot(int root) Set the root node of the TreeWalker. (Not part of the DOM2 TreeWalker interface).- Parameters:
root
- The context node of this step.
-
setNextWalker
Set the next walker in the location step chain.- Parameters:
walker
- Reference to AxesWalker derivative, or may be null.
-
getNextWalker
Get the next walker in the location step chain.- Returns:
- Reference to AxesWalker derivative, or null.
-
setPrevWalker
Set or clear the previous walker reference in the location step chain.- Parameters:
walker
- Reference to previous walker reference in the location step chain, or null.
-
getNextNode
protected int getNextNode()Get the next node in document order on the axes.- Returns:
- the next node in document order on the axes, or null.
-
nextNode
public int nextNode()Moves theTreeWalker
to the next visible node in document order relative to the current node, and returns the new node. If the current node has no next node, or if the search for nextNode attempts to step upward from the TreeWalker's root node, returnsnull
, and retains the current node.- Returns:
- The new node, or
null
if the current node has no next node in the TreeWalker's logical view.
-
getLastPos
Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the last index position.- Specified by:
getLastPos
in interfaceSubContextList
- Specified by:
getLastPos
in classPredicatedNodeTest
- Parameters:
xctxt
- The XPath runtime context.- Returns:
- the number of nodes in the node list.
-
getDTM
Get the DTM for this walker.- Returns:
- Non-null reference to a DTM.
-
getAxis
public int getAxis()Returns the axis being iterated, if it is known.- Returns:
- Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.
-
callVisitors
This will traverse the hierarchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.- Specified by:
callVisitors
in interfaceXPathVisitable
- Overrides:
callVisitors
in classNodeTest
- Parameters:
visitor
- The visitor whose appropriate method will be called.
-
deepEquals
Compare this object with another object and see if they are equal, include the sub heararchy.- Overrides:
deepEquals
in classPredicatedNodeTest
- Parameters:
expr
- Another expression object.- Returns:
- true if this objects class and the expr object's class are the same, and the data contained within both objects are considered equal.
-