Class ConfigurationNodeIteratorChildren<T>
java.lang.Object
org.apache.commons.configuration2.tree.xpath.AbstractConfigurationNodeIterator<T>
org.apache.commons.configuration2.tree.xpath.ConfigurationNodeIteratorChildren<T>
- Type Parameters:
T
- the type of the nodes this iterator deals with
- All Implemented Interfaces:
org.apache.commons.jxpath.ri.model.NodeIterator
A specialized iterator implementation for the child nodes of a configuration node.
- Since:
- 1.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConfigurationNodeIteratorChildren
(ConfigurationNodePointer<T> parent, org.apache.commons.jxpath.ri.compiler.NodeTest nodeTest, boolean reverse, ConfigurationNodePointer<T> startsWith) Creates a new instance ofConfigurationNodeIteratorChildren
and initializes it. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.commons.jxpath.ri.model.NodePointer
createNodePointer
(int position) Creates the configuration node pointer for the current position.createSubNodeList
(T node, org.apache.commons.jxpath.ri.compiler.NodeTest test) Creates the list with sub nodes.createSubNodeListForName
(T node, org.apache.commons.jxpath.ri.QName name) Obtains the list of selected nodes for aNodeNameTest
with either a simple or a qualified name.createSubNodeListForWildcardName
(T node, org.apache.commons.jxpath.ri.QName name) Obtains the list of selected sub nodes for aNodeNameTest
with a wildcard name.private int
findStartIndex
(List<T> children, T startNode) Determines the start position of the iteration.protected int
size()
Returns the number of elements in this iteration.Methods inherited from class org.apache.commons.configuration2.tree.xpath.AbstractConfigurationNodeIterator
getMaxPosition, getNodeHandler, getNodePointer, getParent, getPosition, getStartOffset, positionToIndex, prefixName, qualifiedName, setPosition, setStartOffset
-
Field Details
-
subNodes
The list with the sub nodes to iterate over.
-
-
Constructor Details
-
ConfigurationNodeIteratorChildren
public ConfigurationNodeIteratorChildren(ConfigurationNodePointer<T> parent, org.apache.commons.jxpath.ri.compiler.NodeTest nodeTest, boolean reverse, ConfigurationNodePointer<T> startsWith) Creates a new instance ofConfigurationNodeIteratorChildren
and initializes it.- Parameters:
parent
- the parent pointernodeTest
- the test selecting the sub nodesreverse
- the reverse flagstartsWith
- the first element of the iteration
-
-
Method Details
-
createNodePointer
protected org.apache.commons.jxpath.ri.model.NodePointer createNodePointer(int position) Creates the configuration node pointer for the current position.- Specified by:
createNodePointer
in classAbstractConfigurationNodeIterator<T>
- Parameters:
position
- the current position in the iteration- Returns:
- the node pointer
-
createSubNodeList
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 nodetest
- the test object- Returns:
- a list with the matching nodes
-
createSubNodeListForName
Obtains the list of selected nodes for aNodeNameTest
with either a simple or a qualified name.- Parameters:
node
- the current nodename
- the name to be selected- Returns:
- the list with selected sub nodes
-
createSubNodeListForWildcardName
Obtains the list of selected sub nodes for aNodeNameTest
with a wildcard name.- Parameters:
node
- the current nodename
- the name to be selected- Returns:
- the list with selected sub nodes
-
findStartIndex
Determines the start position of the iteration. Finds the index of the given start node in the children of the root node.- Parameters:
children
- the children of the root nodestartNode
- the start node- Returns:
- the start node's index
-
size
protected int size()Returns the number of elements in this iteration. This is the number of elements in the children list.- Specified by:
size
in classAbstractConfigurationNodeIterator<T>
- Returns:
- the number of elements
-