Class ConfigurationNodeIteratorChildren<T>

  • Type Parameters:
    T - the type of the nodes this iterator deals with
    All Implemented Interfaces:
    org.apache.commons.jxpath.ri.model.NodeIterator

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

      • subNodes

        private final java.util.List<T> subNodes
        The list with the sub nodes to iterate over.
    • Constructor Detail

      • 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 Detail

      • 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 AbstractConfigurationNodeIterator<T>
        Parameters:
        position - the current position in the iteration
        Returns:
        the node pointer
      • createSubNodeList

        private java.util.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 java.util.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 java.util.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​(java.util.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
      • 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 AbstractConfigurationNodeIterator<T>
        Returns:
        the number of elements