Class BreadthFirstEnumeration<N extends Node<E>,​E>

  • Type Parameters:
    N - the type of Node used in the index
    E - the type of Entry used in the index
    All Implemented Interfaces:
    java.util.Iterator<IndexTreePath<E>>

    public class BreadthFirstEnumeration<N extends Node<E>,​E>
    extends java.lang.Object
    implements java.util.Iterator<IndexTreePath<E>>
    Breadth first enumeration over the nodes of an index structure.
    Since:
    0.1
    Author:
    Elke Achtert
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Tests if this enumeration contains more elements.
      IndexTreePath<E> next()
      Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Field Detail

      • EMPTY_ENUMERATION

        public final java.util.Iterator<IndexTreePath<E>> EMPTY_ENUMERATION
        Represents an empty enumeration.
      • queue

        private java.util.Queue<java.util.Iterator<IndexTreePath<E>>> queue
        The queue for the enumeration.
      • index

        private IndexTree<N extends Node<E>,​E> index
        The index storing the nodes.
    • Constructor Detail

      • BreadthFirstEnumeration

        public BreadthFirstEnumeration​(IndexTree<N,​E> index,
                                       IndexTreePath<E> rootPath)
        Creates a new breadth first enumeration with the specified node as root node.
        Parameters:
        index - the index tree storing the nodes
        rootPath - the root entry of the enumeration
    • Method Detail

      • hasNext

        public boolean hasNext()
        Tests if this enumeration contains more elements.
        Specified by:
        hasNext in interface java.util.Iterator<N extends Node<E>>
        Returns:
        true if and only if this enumeration object contains at least one more element to provide; false otherwise.
      • next

        public IndexTreePath<E> next()
        Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
        Specified by:
        next in interface java.util.Iterator<N extends Node<E>>
        Returns:
        the next element of this enumeration.
        Throws:
        java.util.NoSuchElementException - if no more elements exist.