Class DiscriminationTreeIterators


  • public final class DiscriminationTreeIterators
    extends Object
    Factory methods for several kinds of discrimination tree node iterators.
    • Method Detail

      • nodeIterator

        public static <N extends AbstractDTNode<?,​?,​?,​N>> Iterator<N> nodeIterator​(N root)
        Returns an iterator that traverses all nodes of a subtree of a given discrimination tree node.
        Type Parameters:
        N - node type
        Parameters:
        root - the root node, from which traversal should start
        Returns:
        an iterator that traverses all nodes of a subtree of the given node
      • innerNodeIterator

        public static <N extends AbstractDTNode<?,​?,​?,​N>> Iterator<N> innerNodeIterator​(N root)
        Returns an iterator that traverses all inner nodes (no leaves) of a subtree of a given discrimination tree node.
        Type Parameters:
        N - node type
        Parameters:
        root - the root node, from which traversal should start
        Returns:
        an iterator that traverses all inner nodes of a subtree of the given node
      • leafIterator

        public static <N extends AbstractDTNode<?,​?,​?,​N>> Iterator<N> leafIterator​(N root)
        Returns an iterator that traverses all leaves (no inner nodes) of a subtree of a given discrimination tree node.
        Type Parameters:
        N - node type
        Parameters:
        root - the root node, from which traversal should start
        Returns:
        an iterator that traverses all leaf nodes of a subtree of the given node
      • transformingLeafIterator

        public static <N extends AbstractDTNode<?,​?,​?,​N>,​D> Iterator<D> transformingLeafIterator​(N root,
                                                                                                                         Function<? super N,​D> transformer)
        Returns an iterator that traverses all leaves (no inner nodes) of a subtree of a given discrimination tree node. Additionally, allows one to specify a transformer that is applied to the leaf nodes
        Type Parameters:
        N - node type
        D - transformation target data type
        Parameters:
        root - the root node, from which traversal should start
        transformer - the transformer that transforms iterated nodes
        Returns:
        an iterator that traverses all (transformed) leaf nodes of a subtree of the given node