jd.xml.xpath.axis
Class Axis

java.lang.Object
  extended byjd.xml.xpath.axis.Axis
Direct Known Subclasses:
AncestorAxis, AttributeAxis, ChildAxis, DescendantAxis, FollowingAxis, FollowingSiblingAxis, NamespaceAxis, ParentAxis, PrecedingAxis, PrecedingSiblingAxis, RootAxis, SelfAxis

public abstract class Axis
extends Object

Axis is the base class for all axis implementations. Every concrete axis is a singleton class with exactly one instance.


Constructor Summary
protected Axis(String name, boolean isForwardAxis, boolean isDistinctAxis)
          Create the axis.
 
Method Summary
 XPathNode getFirstNode(XPathNode contextNode, NodeTest nodeTest)
          Get the first node of the axis, which matches the nodeTest or null if no match is found.
 int getMaxResultSize(NodeTest test)
          Return the maximum result size or 0 if not known in advance.
 int getMinResultSize(NodeTest test)
          Return the minimum result size or 0 if not known in advance.
abstract  ModelWalker getModelWalker()
          Return a ModelWalker for the axis nodes in document order.
 String getName()
          Return the axis name.
 void getNodes(XPathNode contextNode, NodeTest nodeTest, XMutableNodeSet result)
          Get the nodes of the axis, filtered by the NodeTest.
 int getPrincipalNodeType()
          Return the principal nodes type of the axis.
 ModelWalker getProximityModelWalker()
          Return a ModelWalker for the axis nodes in document order, if the axis is a forward axis or in reverse order if the axis is a reverse axis.
 boolean isDistinctAxis()
          Return if the axis is a "distinct" axis, i.e.
 boolean isForwardAxis()
          Return if the axis is a forward axis.
 String toString()
          Return a string representation of the axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Axis

protected Axis(String name,
               boolean isForwardAxis,
               boolean isDistinctAxis)
Create the axis.

Parameters:
name - the axis name
isForwardAxis - true if the axis is a forward axis
isDistinctAxis - true if the axis is a distinct axis
Method Detail

isForwardAxis

public boolean isForwardAxis()
Return if the axis is a forward axis.


isDistinctAxis

public boolean isDistinctAxis()
Return if the axis is a "distinct" axis, i.e. if applied to different nodes then the resulting nodesets are distinct.


getMaxResultSize

public int getMaxResultSize(NodeTest test)
Return the maximum result size or 0 if not known in advance.


getMinResultSize

public int getMinResultSize(NodeTest test)
Return the minimum result size or 0 if not known in advance.


getPrincipalNodeType

public int getPrincipalNodeType()
Return the principal nodes type of the axis. The default implementation returns ELEMENT.


getName

public final String getName()
Return the axis name.


getNodes

public void getNodes(XPathNode contextNode,
                     NodeTest nodeTest,
                     XMutableNodeSet result)
Get the nodes of the axis, filtered by the NodeTest. The default implementation uses an Axis iterator. Derived implementations could use an optimized way.

Parameters:
contextNode - the context node
nodeTest - the node test
result - a nodeset for the matching nodes.

getFirstNode

public XPathNode getFirstNode(XPathNode contextNode,
                              NodeTest nodeTest)
Get the first node of the axis, which matches the nodeTest or null if no match is found. The default implementation uses an Axis iterator. Derived implementations could use an optimized way.


getModelWalker

public abstract ModelWalker getModelWalker()
Return a ModelWalker for the axis nodes in document order.


getProximityModelWalker

public ModelWalker getProximityModelWalker()
Return a ModelWalker for the axis nodes in document order, if the axis is a forward axis or in reverse order if the axis is a reverse axis. The default calls getModelWalker()


toString

public String toString()
Return a string representation of the axis.