jd.xml.xpath.model.walk
Interface ModelWalker

All Known Implementing Classes:
AncestorAxis, AncestorWalker, ChainWalker, ChildWalker, DescendantsWalker, EmptyWalker, FollowingSiblingAxis, FollowingWalker, ListWalker, NameTestWalker, NodeTestWalker, ParentAxis, PrecedingSiblingAxis, PrecedingSiblingWalker, ReversePrecedingWalker, RootAxis, SelfAxis, TypeTestWalker

public interface ModelWalker

A ModelWalker represents a certain way to navigate through a XPath tree.

Usage:

ModelWalker walker = ...
 XPathNode startNode = ...
 XPathNode node = walker.gotoFirstNode(startNode);
 while(node != null)
 {
     ...
     node = walker.gotoNextNode(node);
 }
 
The ModelWalker interface is designed to allow implementations that don't need store internal state as a iterator would have to and therefore can be implemented as singleton objects (for example some axis classes represents ModelWalkers for their axis nodes).


Method Summary
 XPathNode gotoFirstNode(XPathNode startNode)
          Return the first node of the path defined by the startNode
 XPathNode gotoNextNode(XPathNode lastNode)
          Return the next node of the path.
 

Method Detail

gotoFirstNode

public XPathNode gotoFirstNode(XPathNode startNode)
Return the first node of the path defined by the startNode

Returns:
the first node of the path represented by this ModelWalker.- If null the path is empty.

gotoNextNode

public XPathNode gotoNextNode(XPathNode lastNode)
Return the next node of the path.

Parameters:
lastNode - a XPathNode obtained from the last call to gotoFirstNode or gotoNextNode. If the node is another node the behaviour is not determined.
Returns:
the next node of the path represented by this ModelWalker.- If null then the path ended.