org.apache.directory.server.core.partition.impl.btree
Class DisjunctionEnumeration

java.lang.Object
  extended by org.apache.directory.server.core.partition.impl.btree.DisjunctionEnumeration
All Implemented Interfaces:
java.util.Enumeration, javax.naming.NamingEnumeration

public class DisjunctionEnumeration
extends java.lang.Object
implements javax.naming.NamingEnumeration

A Cursor of Cursors performing a union on all underlying Cursors resulting in the disjunction of expressions represented by the constituant child Cursors. This cursor prefetches underlying Cursor values so that it can comply with the defined Cursor semantics.

Version:
$Rev: 434579 $
Author:
Apache Directory Project

Constructor Summary
DisjunctionEnumeration(javax.naming.NamingEnumeration[] children)
          Creates a DisjunctionEnumeration over a set of child NamingEnumerations.
 
Method Summary
 void close()
          Closes all the underlying Cursors and not fail fast.
 boolean hasMore()
          Tests if a prefetched value exists and a call to advance will hence succeed.
 boolean hasMoreElements()
           
 java.lang.Object next()
          Advances this Cursor one position.
 java.lang.Object nextElement()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisjunctionEnumeration

public DisjunctionEnumeration(javax.naming.NamingEnumeration[] children)
                       throws javax.naming.NamingException
Creates a DisjunctionEnumeration over a set of child NamingEnumerations. The returned result is the union of all underlying NamingEnumerations without duplicates.

Parameters:
children - array of child NamingInstances
Throws:
javax.naming.NamingException - if something goes wrong
Method Detail

nextElement

public java.lang.Object nextElement()
Specified by:
nextElement in interface java.util.Enumeration
See Also:
Enumeration.nextElement()

hasMoreElements

public boolean hasMoreElements()
Specified by:
hasMoreElements in interface java.util.Enumeration
See Also:
Enumeration.hasMoreElements()

next

public java.lang.Object next()
                      throws javax.naming.NamingException
Advances this Cursor one position. Duplicates are not returned so if underlying cursors keep returning duplicates the child cursors will be advanced until a unique candidate is found or all child cursors are exhausted.

Specified by:
next in interface javax.naming.NamingEnumeration
Returns:
a candidate element
Throws:
javax.naming.NamingException - if an error occurs

hasMore

public boolean hasMore()
Tests if a prefetched value exists and a call to advance will hence succeed.

Specified by:
hasMore in interface javax.naming.NamingEnumeration
Returns:
true if a call to advance will succeed false otherwise.

close

public void close()
           throws javax.naming.NamingException
Closes all the underlying Cursors and not fail fast. All enumerations will have close attempts made on them.

Specified by:
close in interface javax.naming.NamingEnumeration
Throws:
javax.naming.NamingException - if we cannot close all enumerations


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.