de.lmu.ifi.dbs.elki.index.tree
Class BreadthFirstEnumeration<N extends Node<E>,E extends Entry>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.index.tree.BreadthFirstEnumeration<N,E>
Type Parameters:
N - the type of Node used in the index
E - the type of Entry used in the index
All Implemented Interfaces:
Enumeration<IndexTreePath<E>>

public class BreadthFirstEnumeration<N extends Node<E>,E extends Entry>
extends Object
implements Enumeration<IndexTreePath<E>>

Provides a breadth first enumeration over the nodes of an index structure.


Field Summary
 Enumeration<IndexTreePath<E>> EMPTY_ENUMERATION
          Represents an empty enumeration.
private  IndexTree<N,E> index
          The index storing the nodes.
private  Queue<Enumeration<IndexTreePath<E>>> queue
          The queue for the enumeration.
 
Constructor Summary
BreadthFirstEnumeration(IndexTree<N,E> index, IndexTreePath<E> rootPath)
          Creates a new breadth first enumeration with the specified node as root node.
 
Method Summary
 boolean hasMoreElements()
          Tests if this enumeration contains more elements.
 IndexTreePath<E> nextElement()
          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
 

Field Detail

EMPTY_ENUMERATION

public final Enumeration<IndexTreePath<E extends Entry>> EMPTY_ENUMERATION
Represents an empty enumeration.


queue

private Queue<Enumeration<IndexTreePath<E extends Entry>>> queue
The queue for the enumeration.


index

private IndexTree<N extends Node<E>,E extends Entry> 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

hasMoreElements

public boolean hasMoreElements()
Tests if this enumeration contains more elements.

Specified by:
hasMoreElements in interface Enumeration<IndexTreePath<E extends Entry>>
Returns:
true if and only if this enumeration object contains at least one more element to provide; false otherwise.

nextElement

public IndexTreePath<E> nextElement()
Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Specified by:
nextElement in interface Enumeration<IndexTreePath<E extends Entry>>
Returns:
the next element of this enumeration.
Throws:
NoSuchElementException - if no more elements exist.

Release 0.4.0 (2011-09-20_1324)