org.apache.commons.configuration.tree.xpath

Class ConfigurationNodeIteratorChildren

class ConfigurationNodeIteratorChildren extends ConfigurationNodeIteratorBase

A specialized iterator implementation for the child nodes of a configuration node.

Since: 1.3

Version: $Id: ConfigurationNodeIteratorChildren.java 439648 2006-09-02 20:42:10Z oheger $

Author: Oliver Heger

Constructor Summary
ConfigurationNodeIteratorChildren(NodePointer parent, NodeTest nodeTest, boolean reverse, NodePointer startsWith)
Creates a new instance of ConfigurationNodeIteratorChildren and initializes it.
Method Summary
protected ListcreateSubNodeList(ConfigurationNode node, NodeTest test)
Creates the list with sub nodes.
protected intfindStartIndex(ConfigurationNode node, ConfigurationNode startNode)
Determines the start position of the iteration.

Constructor Detail

ConfigurationNodeIteratorChildren

public ConfigurationNodeIteratorChildren(NodePointer parent, NodeTest nodeTest, boolean reverse, NodePointer startsWith)
Creates a new instance of ConfigurationNodeIteratorChildren and initializes it.

Parameters: parent the parent pointer nodeTest the test selecting the sub nodes reverse the reverse flag startsWith the first element of the iteration

Method Detail

createSubNodeList

protected List createSubNodeList(ConfigurationNode node, NodeTest test)
Creates the list with sub nodes. This method gets called during initialization phase. It finds out, based on the given test, which nodes must be iterated over.

Parameters: node the current node test the test object

Returns: a list with the matching nodes

findStartIndex

protected int findStartIndex(ConfigurationNode node, ConfigurationNode startNode)
Determines the start position of the iteration. Finds the index of the given start node in the children of the root node.

Parameters: node the root node startNode the start node

Returns: the start node's index