org.apache.xpath.axes
Class PredicatedNodeTest

java.lang.Object
  |
  +--org.apache.xpath.Expression
        |
        +--org.apache.xpath.patterns.NodeTest
              |
              +--org.apache.xpath.axes.PredicatedNodeTest
Direct Known Subclasses:
AxesWalker, LocPathIterator

public abstract class PredicatedNodeTest
extends NodeTest
implements SubContextList

See Also:
Serialized Form

Fields inherited from class org.apache.xpath.patterns.NodeTest
SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, SHOW_NAMESPACE, SUPPORTS_PRE_STRIPPING, WILD
 
Constructor Summary
PredicatedNodeTest()
          Construct an AxesWalker.
PredicatedNodeTest(LocPathIterator locPathIterator)
          Construct an AxesWalker using a LocPathIterator.
 
Method Summary
 short acceptNode(Node n)
          Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.
 boolean canTraverseOutsideSubtree()
          Tell if this expression or it's subexpressions can traverse outside the current subtree.
 java.lang.Object clone()
          Get a cloned AxesWalker.
abstract  int getLastPos(XPathContext xctxt)
          Get the index of the last node that can be itterated to.
 LocPathIterator getLocPathIterator()
          Get the owning location path iterator.
 int getPredicateCount()
          Get the number of predicates that this walker has.
 int getPredicateIndex()
          Get which predicate is executing.
 int getProximityPosition()
          Get the current sub-context position.
 int getProximityPosition(XPathContext xctxt)
          Get the current sub-context position.
 void initProximityPosition(int i)
          Init the proximity position to zero for a forward axes.
 boolean isReverseAxes()
          Tells if this is a reverse axes.
 void resetProximityPositions()
          Reset the proximity positions counts.
 void setLocPathIterator(LocPathIterator li)
          Set the location path iterator owner for this walker.
 void setPredicateCount(int count)
          Set the number of predicates that this walker has.
 
Methods inherited from class org.apache.xpath.patterns.NodeTest
debugWhatToShow, execute, execute, getDefaultScore, getLocalName, getNamespace, getWhatToShow, initNodeTest, initNodeTest
 
Methods inherited from class org.apache.xpath.Expression
assert, error, setSourceLocator, warn
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredicatedNodeTest

public PredicatedNodeTest(LocPathIterator locPathIterator)
Construct an AxesWalker using a LocPathIterator.
Parameters:
locPathIterator - non-null reference to the parent iterator.

PredicatedNodeTest

public PredicatedNodeTest()
Construct an AxesWalker. The location path iterator will have to be set before use.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Get a cloned AxesWalker.
Returns:
A new AxesWalker that can be used without mutating this one.
Throws:
java.lang.CloneNotSupportedException -  

getPredicateCount

public int getPredicateCount()
Get the number of predicates that this walker has.
Returns:
the number of predicates that this walker has.

setPredicateCount

public void setPredicateCount(int count)
Set the number of predicates that this walker has. This does more that one would think, as it creates a new predicate array of the size of the count argument, and copies count predicates into the new one from the old, and then reassigns the predicates value. All this to keep from having to have a predicate count value.
Parameters:
count - The number of predicates, which must be equal or less than the existing count.

getProximityPosition

public int getProximityPosition()
Get the current sub-context position.
Returns:
The node position of this walker in the sub-context node list.

getProximityPosition

public int getProximityPosition(XPathContext xctxt)
Get the current sub-context position.
Specified by:
getProximityPosition in interface SubContextList
Parameters:
xctxt - The XPath runtime context.
Returns:
The node position of this walker in the sub-context node list.

getLastPos

public abstract int getLastPos(XPathContext xctxt)
Get the index of the last node that can be itterated to.
Specified by:
getLastPos in interface SubContextList
Parameters:
xctxt - XPath runtime context.
Returns:
the index of the last node that can be itterated to.

resetProximityPositions

public void resetProximityPositions()
Reset the proximity positions counts.

initProximityPosition

public void initProximityPosition(int i)
                           throws TransformerException
Init the proximity position to zero for a forward axes.
Parameters:
i - The index into the m_proximityPositions array.
Throws:
TransformerException -  

isReverseAxes

public boolean isReverseAxes()
Tells if this is a reverse axes.
Returns:
false, unless a derived class overrides.

getPredicateIndex

public int getPredicateIndex()
Get which predicate is executing.
Returns:
The current predicate index, or -1 if no predicate is executing.

acceptNode

public short acceptNode(Node n)
Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator. This function will be called by the implementation of TreeWalker and NodeIterator; it is not intended to be called directly from user code.
Parameters:
n - The node to check to see if it passes the filter or not.
Returns:
a constant to determine whether the node is accepted, rejected, or skipped, as defined above .

getLocPathIterator

public LocPathIterator getLocPathIterator()
Get the owning location path iterator.
Returns:
the owning location path iterator, which should not be null.

setLocPathIterator

public void setLocPathIterator(LocPathIterator li)
Set the location path iterator owner for this walker. Besides initialization, this function is called during cloning operations.
Parameters:
li - non-null reference to the owning location path iterator.

canTraverseOutsideSubtree

public boolean canTraverseOutsideSubtree()
Tell if this expression or it's subexpressions can traverse outside the current subtree.
Returns:
true if traversal outside the context node's subtree can occur.
Overrides:
canTraverseOutsideSubtree in class Expression


Copyright � 2000 Apache XML Project. All Rights Reserved.