Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.xpath.Expression
org.apache.xpath.patterns.NodeTest
org.apache.xpath.axes.PredicatedNodeTest
org.apache.xpath.axes.AxesWalker
public class AxesWalker
extends PredicatedNodeTest
implements Cloneable, PathComponent, ExpressionOwner
Field Summary |
Fields inherited from class org.apache.xpath.patterns.NodeTest | |
SCORE_NODETEST , SCORE_NONE , SCORE_NSWILD , SCORE_OTHER , SCORE_QNAME , SHOW_BYFUNCTION , SUPPORTS_PRE_STRIPPING , WILD |
Constructor Summary | |
|
Method Summary | |
void |
|
Object |
|
boolean |
|
void |
|
int |
|
int |
|
int |
|
DTM |
|
Expression | |
int |
|
AxesWalker |
|
AxesWalker |
|
int |
|
void | |
boolean |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
WalkingIterator |
|
Methods inherited from class org.apache.xpath.axes.PredicatedNodeTest | |
acceptNode , callPredicateVisitors , canTraverseOutsideSubtree , clone , deepEquals , fixupVariables , getLastPos , getLocPathIterator , getPredicate , getPredicateCount , getPredicateIndex , getProximityPosition , getProximityPosition , initProximityPosition , isReverseAxes , resetProximityPositions , setLocPathIterator , setPredicateCount |
Methods inherited from class org.apache.xpath.patterns.NodeTest | |
callVisitors , debugWhatToShow , deepEquals , execute , execute , execute , fixupVariables , getDefaultScore , getLocalName , getNamespace , getNodeTypeTest , getStaticScore , getWhatToShow , initNodeTest , initNodeTest , setLocalName , setNamespace , setStaticScore , setWhatToShow |
Methods inherited from class org.apache.xpath.Expression | |
asIterator , asIteratorRaw , asNode , assertion , bool , canTraverseOutsideSubtree , deepEquals , error , execute , execute , execute , execute , executeCharsToContentHandler , exprAddChild , exprGetChild , exprGetNumChildren , exprGetParent , exprSetParent , fixupVariables , getColumnNumber , getExpressionOwner , getLineNumber , getPublicId , getSystemId , isNodesetExpr , isStableNumber , num , warn , xstr |
public AxesWalker(LocPathIterator locPathIterator, int axis)
Construct an AxesWalker using a LocPathIterator.
- Parameters:
locPathIterator
- non-null reference to the parent iterator.
public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.
- Specified by:
- callVisitors in interface XPathVisitable
- Overrides:
- callVisitors in interface NodeTest
- Parameters:
owner
- The owner of the visitor, where that path may be rewritten if needed.visitor
- The visitor whose appropriate method will be called.
public Object clone() throws CloneNotSupportedException
Get a cloned AxesWalker.
- Overrides:
- clone in interface PredicatedNodeTest
- Returns:
- A new AxesWalker that can be used without mutating this one.
public boolean deepEquals(Expression expr)
- Overrides:
- deepEquals in interface PredicatedNodeTest
- See Also:
Expression.deepEquals(Expression)
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.
public int getAnalysisBits()
Get the analysis bits for this walker, as defined in the WalkerFactory.
- Specified by:
- getAnalysisBits in interface PathComponent
- Returns:
- One of WalkerFactory#BIT_DESCENDANT, etc.
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.
public final int getCurrentNode()
The node at which the TreeWalker is currently positioned.
The value must not be null. Alterations to the DOM tree may cause the current node to no longer be accepted by the TreeWalker's associated filter. currentNode may also be explicitly set to any node, whether or not it is within the subtree specified by the root node or would be accepted by the filter and whatToShow flags. Further traversal occurs relative to currentNode even if it is not part of the current view by applying the filters in the requested direction (not changing currentNode where no traversal is possible).
- Returns:
- The node at which the TreeWalker is currently positioned, only null if setRoot has not yet been called.
public Expression getExpression()
- Specified by:
- getExpression in interface ExpressionOwner
- See Also:
ExpressionOwner.getExpression()
public int getLastPos(XPathContext xctxt)
Get the index of the last node that can be itterated to.
- Specified by:
- getLastPos in interface SubContextList
- Overrides:
- getLastPos in interface PredicatedNodeTest
- Parameters:
xctxt
- XPath runtime context.
- Returns:
- the index of the last node that can be itterated to.
public AxesWalker getNextWalker()
Get the next walker in the location step chain.
- Returns:
- Reference to AxesWalker derivative, or null.
public AxesWalker getPrevWalker()
Get the previous walker reference in the location step chain.
- Returns:
- Reference to previous walker reference in the location step chain, or null.
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.
public void init(Compiler compiler, int opPos, int stepType) throws TransformerException
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.
public boolean isDocOrdered()
Returns true if all the nodes in the iteration well be returned in document order. Warning: This can only be called after setRoot has been called!
- Returns:
- true as a default.
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.
public void setDefaultDTM(DTM dtm)
Set the DTM for this walker.
- Parameters:
dtm
- Non-null reference to a DTM.
public void setExpression(Expression exp)
- Specified by:
- setExpression in interface ExpressionOwner
public void setNextWalker(AxesWalker walker)
Set the next walker in the location step chain.
- Parameters:
walker
- Reference to AxesWalker derivative, or may be null.
public void setPrevWalker(AxesWalker walker)
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.
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.