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

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

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

A simple NamingEnumeration over a TupleBrowser on a table that does not allow duplicates.

WARNING: The Tuple returned by this listing is always the same instance object returned every time. It is reused to for the sake of efficency rather than creating a new tuple for each hasMore() call.

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

Constructor Summary
NoDupsEnumeration(TupleBrowser browser, boolean doAscendingScan)
          Creates a cursor over a TupleBrowser where duplicates are not expected.
 
Method Summary
 void close()
          Sets hasNext to false.
 boolean doAscendingScan()
          Gets the direction of this NamingEnumeration.
 boolean hasMore()
           
 boolean hasMoreElements()
          Calls hasMore.
 java.lang.Object next()
          Returns the same Tuple every time but with different key/value pairs.
 java.lang.Object nextElement()
          Returns the same Tuple every time but with different key/value pairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoDupsEnumeration

public NoDupsEnumeration(TupleBrowser browser,
                         boolean doAscendingScan)
                  throws javax.naming.NamingException
Creates a cursor over a TupleBrowser where duplicates are not expected.

Throws:
javax.naming.NamingException
Method Detail

next

public java.lang.Object next()
                      throws javax.naming.NamingException
Returns the same Tuple every time but with different key/value pairs.

Specified by:
next in interface javax.naming.NamingEnumeration
Throws:
javax.naming.NamingException
See Also:
NamingEnumeration.next()

nextElement

public java.lang.Object nextElement()
Returns the same Tuple every time but with different key/value pairs.

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

hasMore

public boolean hasMore()
Specified by:
hasMore in interface javax.naming.NamingEnumeration
See Also:
NamingEnumeration.hasMore()

hasMoreElements

public boolean hasMoreElements()
Calls hasMore.

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

close

public void close()
Sets hasNext to false.

Specified by:
close in interface javax.naming.NamingEnumeration
See Also:
NamingEnumeration.close()

doAscendingScan

public boolean doAscendingScan()
Gets the direction of this NamingEnumeration.

Returns:
true if this NamingEnumeration is ascending on keys, false otherwise.


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