Class ConfigurationNodeIteratorChildren<T>

java.lang.Object
org.apache.commons.configuration2.tree.xpath.ConfigurationNodeIteratorBase<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

class ConfigurationNodeIteratorChildren<T> extends ConfigurationNodeIteratorBase<T>
A specialized iterator implementation for the child nodes of a configuration node.
Since:
1.3
  • Field Details

    • subNodes

      private final List<T> 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 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 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 class ConfigurationNodeIteratorBase<T>
      Parameters:
      position - the current position in the iteration
      Returns:
      the node pointer
    • 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 class ConfigurationNodeIteratorBase<T>
      Returns:
      the number of elements
    • createSubNodeList

      private List<T> createSubNodeList(T node, org.apache.commons.jxpath.ri.compiler.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
    • createSubNodeListForName

      private List<T> createSubNodeListForName(T node, org.apache.commons.jxpath.ri.QName name)
      Obtains the list of selected nodes for a NodeNameTest with either a simple or a qualified name.
      Parameters:
      node - the current node
      name - the name to be selected
      Returns:
      the list with selected sub nodes
    • createSubNodeListForWildcardName

      private List<T> createSubNodeListForWildcardName(T node, org.apache.commons.jxpath.ri.QName name)
      Obtains the list of selected sub nodes for a NodeNameTest with a wildcard name.
      Parameters:
      node - the current node
      name - the name to be selected
      Returns:
      the list with selected sub nodes
    • findStartIndex

      private int findStartIndex(List<T> children, T startNode)
      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 node
      startNode - the start node
      Returns:
      the start node's index