Top Description Fields Constructors Methods
com.sun.org.apache.xpath.internal.axes

public Class AxesWalker

extends PredicatedNodeTest
implements Cloneable, PathComponent, ExpressionOwner
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xpath.internal.ExpressionOwner, com.sun.org.apache.xpath.internal.axes.PathComponent, java.lang.Cloneable
Known Direct Subclasses
com.sun.org.apache.xpath.internal.axes.FilterExprWalker, com.sun.org.apache.xpath.internal.axes.ReverseAxesWalker
Imports
com.sun.org.apache.xalan.internal.res.XSLMessages, com.sun.org.apache.xml.internal.dtm.DTM, .DTMAxisTraverser, .DTMIterator, com.sun.org.apache.xpath.internal.Expression, .ExpressionOwner, .XPathContext, .XPathVisitor, com.sun.org.apache.xpath.internal.compiler.Compiler, com.sun.org.apache.xpath.internal.res.XPATHErrorResources, java.util.List

Serves as common interface for axes Walkers, and stores common state variables.

Field Summary

Modifier and TypeField and Description
protected int
m_axis

The traversal axis from where the nodes will be filtered.

private transient int
m_currentNode

The node at which the TreeWalker is currently positioned.

private DTM
m_dtm

The DTM for the root.

pack-priv transient boolean
m_isFresh

True if an itteration has not begun.

protected AxesWalker
m_nextWalker

The next walker in the location step chain.

pack-priv AxesWalker
m_prevWalker

The previous walker in the location step chain, or null.

pack-priv transient int
m_root

The root node of the TreeWalker, as specified when it was created.

protected DTMAxisTraverser
m_traverser

The DTM inner traversal class, that corresponds to the super axis.

pack-priv static final long
Inherited from com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest:
DEBUG_PREDICATECOUNTINGm_foundLastm_lpim_predCountm_predicateIndexm_proximityPositions

Constructor Summary

AccessConstructor and Description
public
AxesWalker(LocPathIterator
non-null reference to the parent iterator.
locPathIterator
,
int axis)

Construct an AxesWalker using a LocPathIterator.

Method Summary

Modifier and TypeMethod and Description
public void
callVisitors(ExpressionOwner
The owner of the visitor, where that path may be rewritten if needed.
owner
,
XPathVisitor
The visitor whose appropriate method will be called.
visitor
)

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.callVisitors.

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member.

public Object

Returns:

A new AxesWalker that can be used without mutating this one.
clone
()

Overrides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.clone.

Get a cloned AxesWalker.

pack-priv AxesWalker

Returns:

non-null clone, which may be a new clone, or may be a clone contained on the cloneList.
cloneDeep
(WalkingIterator
non-null reference to the cloned location path iterator to which this clone will be added.
cloneOwner
,
List<AxesWalker>
non-null vector of sources in odd elements, and the corresponding clones in even vectors.
cloneList
)

Do a deep clone of this walker, including next and previous walkers.

public boolean
deepEquals(Expression
Another expression object.
expr
)

Overrides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.deepEquals.

Compare this object with another object and see if they are equal, include the sub heararchy.

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.

pack-priv static AxesWalker

Returns:

A clone that corresponds to the key, or null if key not found.
findClone
(AxesWalker
The original AxesWalker for which there may be a clone.
key
,
List<AxesWalker>
vector of sources in odd elements, and the corresponding clones in even vectors, may be null.
cloneList
)

Find a clone that corresponds to the key argument.

public int

Returns:

One of WalkerFactory#BIT_DESCENDANT, etc.
getAnalysisBits
()

Implements com.sun.org.apache.xpath.internal.axes.PathComponent.getAnalysisBits.

Get the analysis bits for this walker, as defined in the WalkerFactory.

public int

Returns:

Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.
getAxis
()

Returns the axis being iterated, if it is known.

public final int

Returns:

The node at which the TreeWalker is currently positioned, only null if setRoot has not yet been called.
getCurrentNode
()

The node at which the TreeWalker is currently positioned.

public DTM

Returns:

Non-null reference to a DTM.
getDTM
(int node)

Get the DTM for this walker.

public Expression
getExpression()

Implements com.sun.org.apache.xpath.internal.ExpressionOwner.getExpression.

Get the raw Expression object that this class wraps.

public int

Returns:

the index of the last node that can be itterated to.
getLastPos
(XPathContext
XPath runtime context.
xctxt
)

Implements abstract com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.getLastPos.

Implements com.sun.org.apache.xpath.internal.axes.SubContextList.getLastPos.

Get the index of the last node that can be itterated to.

protected int

Returns:

the next node in document order on the axes, or null.
getNextNode
()

Get the next node in document order on the axes.

public AxesWalker

Returns:

Reference to AxesWalker derivative, or null.
getNextWalker
()

Get the next walker in the location step chain.

public AxesWalker

Returns:

Reference to previous walker reference in the location step chain, or null.
getPrevWalker
()

Get the previous walker reference in the location step chain.

public int

Returns:

The context node of the step.
getRoot
()

The root node of the TreeWalker, as specified in setRoot(int root).

public void
init(Compiler
The Compiler object that has information about this walker in the op map.
compiler
,
int
The op code position of this location step.
opPos
,
int
The type of location step.
stepType
)

Initialize an AxesWalker during the parse of the XPath expression.

public boolean

Returns:

true as a default.
isDocOrdered
()

Returns true if all the nodes in the iteration well be returned in document order.

public int

Returns:

The new node, or null if the current node has no next node in the TreeWalker's logical view.
nextNode
()

Moves the TreeWalker to the next visible node in document order relative to the current node, and returns the new node.

private int

Returns:

The argument.
returnNextNode
(int
Node to return, or null.
n
)

This is simply a way to bottle-neck the return of the next node, for diagnostic purposes.

public void
setDefaultDTM(DTM
Non-null reference to a DTM.
dtm
)

Set the DTM for this walker.

public void
setExpression(Expression
the raw Expression object, which should not normally be null.
exp
)

Implements com.sun.org.apache.xpath.internal.ExpressionOwner.setExpression.

Set the raw expression object for this object.

public void
setNextWalker(AxesWalker
Reference to AxesWalker derivative, or may be null.
walker
)

Set the next walker in the location step chain.

public void
setPrevWalker(AxesWalker
Reference to previous walker reference in the location step chain, or null.
walker
)

Set or clear the previous walker reference in the location step chain.

public void
setRoot(int
The context node of this step.
root
)

Set the root node of the TreeWalker.

public final WalkingIterator
wi()

Inherited from com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest:
acceptNodecallPredicateVisitorscanTraverseOutsideSubtreecountProximityPositionexecutePredicatesfixupVariablesgetLocPathIteratorgetPredicategetPredicateCountgetPredicateIndexgetProximityPositiongetProximityPositiongetProximityPositioninitPredicateInfoinitProximityPositionisReverseAxesnodeToStringresetProximityPositionssetLocPathIteratorsetPredicateCount

Field Detail

m_axisback to summary
protected int m_axis

The traversal axis from where the nodes will be filtered.

m_currentNodeback to summary
private transient int m_currentNode

The node at which the TreeWalker is currently positioned.

m_dtmback to summary
private DTM m_dtm

The DTM for the root. This can not be used, or must be changed, for the filter walker, or any walker that can have nodes from multiple documents. Never, ever, access this value without going through getDTM(int node).

Annotations
@SuppressWarnings:serial
m_isFreshback to summary
pack-priv transient boolean m_isFresh

True if an itteration has not begun.

m_nextWalkerback to summary
protected AxesWalker m_nextWalker

The next walker in the location step chain.

m_prevWalkerback to summary
pack-priv AxesWalker m_prevWalker

The previous walker in the location step chain, or null.

m_rootback to summary
pack-priv transient int m_root

The root node of the TreeWalker, as specified when it was created.

m_traverserback to summary
protected DTMAxisTraverser m_traverser

The DTM inner traversal class, that corresponds to the super axis.

Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.serialVersionUID.

Constructor Detail

AxesWalkerback to summary
public AxesWalker(LocPathIterator locPathIterator, int axis)

Construct an AxesWalker using a LocPathIterator.

Parameters
locPathIterator:LocPathIterator

non-null reference to the parent iterator.

Method Detail

callVisitorsback to summary
public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)

Overrides com.sun.org.apache.xpath.internal.patterns.NodeTest.callVisitors.

Implements com.sun.org.apache.xpath.internal.XPathVisitable.callVisitors.

This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.

Parameters
owner:ExpressionOwner

The owner of the visitor, where that path may be rewritten if needed.

visitor:XPathVisitor

The visitor whose appropriate method will be called.

cloneback to summary
public Object clone() throws CloneNotSupportedException

Overrides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.clone.

Get a cloned AxesWalker.

Returns:Object

A new AxesWalker that can be used without mutating this one.

Exceptions
CloneNotSupportedException:

Doc from java.lang.Object.clone.

if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

cloneDeepback to summary
pack-priv AxesWalker cloneDeep(WalkingIterator cloneOwner, List<AxesWalker> cloneList) throws CloneNotSupportedException

Do a deep clone of this walker, including next and previous walkers. If the this AxesWalker is on the clone list, don't clone but return the already cloned version.

Parameters
cloneOwner:WalkingIterator

non-null reference to the cloned location path iterator to which this clone will be added.

cloneList:List<AxesWalker>

non-null vector of sources in odd elements, and the corresponding clones in even vectors.

Returns:AxesWalker

non-null clone, which may be a new clone, or may be a clone contained on the cloneList.

deepEqualsback to summary
public boolean deepEquals(Expression expr)

Overrides com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.deepEquals.

Doc from com.sun.org.apache.xpath.internal.Expression.deepEquals.

Compare this object with another object and see if they are equal, include the sub heararchy.

Parameters
expr:Expression

Another expression object.

Returns:boolean

true if this objects class and the expr object's class are the same, and the data contained within both objects are considered equal.

See Also
Expression#deepEquals(Expression)
detachback to summary
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.

findCloneback to summary
pack-priv static AxesWalker findClone(AxesWalker key, List<AxesWalker> cloneList)

Find a clone that corresponds to the key argument.

Parameters
key:AxesWalker

The original AxesWalker for which there may be a clone.

cloneList:List<AxesWalker>

vector of sources in odd elements, and the corresponding clones in even vectors, may be null.

Returns:AxesWalker

A clone that corresponds to the key, or null if key not found.

getAnalysisBitsback to summary
public int getAnalysisBits()

Implements com.sun.org.apache.xpath.internal.axes.PathComponent.getAnalysisBits.

Get the analysis bits for this walker, as defined in the WalkerFactory.

Returns:int

One of WalkerFactory#BIT_DESCENDANT, etc.

getAxisback to summary
public int getAxis()

Returns the axis being iterated, if it is known.

Returns:int

Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.

getCurrentNodeback to summary
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:int

The node at which the TreeWalker is currently positioned, only null if setRoot has not yet been called.

getDTMback to summary
public DTM getDTM(int node)

Get the DTM for this walker.

Returns:DTM

Non-null reference to a DTM.

getExpressionback to summary
public Expression getExpression()

Implements com.sun.org.apache.xpath.internal.ExpressionOwner.getExpression.

Doc from com.sun.org.apache.xpath.internal.ExpressionOwner.getExpression.

Get the raw Expression object that this class wraps.

Returns:Expression

the raw Expression object, which should not normally be null.

See Also
ExpressionOwner#getExpression()
getLastPosback to summary
public int getLastPos(XPathContext xctxt)

Implements abstract com.sun.org.apache.xpath.internal.axes.PredicatedNodeTest.getLastPos.

Implements com.sun.org.apache.xpath.internal.axes.SubContextList.getLastPos.

Get the index of the last node that can be itterated to.

Parameters
xctxt:XPathContext

XPath runtime context.

Returns:int

the index of the last node that can be itterated to.

getNextNodeback to summary
protected int getNextNode()

Get the next node in document order on the axes.

Returns:int

the next node in document order on the axes, or null.

getNextWalkerback to summary
public AxesWalker getNextWalker()

Get the next walker in the location step chain.

Returns:AxesWalker

Reference to AxesWalker derivative, or null.

getPrevWalkerback to summary
public AxesWalker getPrevWalker()

Get the previous walker reference in the location step chain.

Returns:AxesWalker

Reference to previous walker reference in the location step chain, or null.

getRootback to summary
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:int

The context node of the step.

initback to summary
public void init(Compiler compiler, int opPos, int stepType) throws TransformerException

Initialize an AxesWalker during the parse of the XPath expression.

Parameters
compiler:Compiler

The Compiler object that has information about this walker in the op map.

opPos:int

The op code position of this location step.

stepType:int

The type of location step.

isDocOrderedback to summary
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:boolean

true as a default.

nextNodeback to summary
public int nextNode()

Moves the TreeWalker 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, returns null , and retains the current node.

Returns:int

The new node, or null if the current node has no next node in the TreeWalker's logical view.

returnNextNodeback to summary
private int returnNextNode(int n)

This is simply a way to bottle-neck the return of the next node, for diagnostic purposes.

Parameters
n:int

Node to return, or null.

Returns:int

The argument.

setDefaultDTMback to summary
public void setDefaultDTM(DTM dtm)

Set the DTM for this walker.

Parameters
dtm:DTM

Non-null reference to a DTM.

setExpressionback to summary
public void setExpression(Expression exp)

Implements com.sun.org.apache.xpath.internal.ExpressionOwner.setExpression.

Doc from com.sun.org.apache.xpath.internal.ExpressionOwner.setExpression.

Set the raw expression object for this object.

Parameters
exp:Expression

the raw Expression object, which should not normally be null.

See Also
ExpressionOwner#setExpression(Expression)
setNextWalkerback to summary
public void setNextWalker(AxesWalker walker)

Set the next walker in the location step chain.

Parameters
walker:AxesWalker

Reference to AxesWalker derivative, or may be null.

setPrevWalkerback to summary
public void setPrevWalker(AxesWalker walker)

Set or clear the previous walker reference in the location step chain.

Parameters
walker:AxesWalker

Reference to previous walker reference in the location step chain, or null.

setRootback to summary
public void setRoot(int root)

Set the root node of the TreeWalker. (Not part of the DOM2 TreeWalker interface).

Parameters
root:int

The context node of this step.

wiback to summary
public final WalkingIterator wi()