com.sleepycat.persist
Class SubIndexCursor<V>

java.lang.Object
  extended by com.sleepycat.persist.BasicCursor<V>
      extended by com.sleepycat.persist.SubIndexCursor<V>
All Implemented Interfaces:
EntityCursor<V>, ForwardCursor<V>, java.lang.Iterable<V>

 class SubIndexCursor<V>
extends BasicCursor<V>

The cursor for a SubIndex treats Dup and NoDup operations specially because the SubIndex never has duplicates -- the keys are primary keys. So a next/prevDup operation always returns null, and a next/prevNoDup operation actually does next/prev.

Author:
Mark Hayes

Field Summary
 
Fields inherited from class com.sleepycat.persist.BasicCursor
adapter, cursor, data, key, pkey
 
Constructor Summary
SubIndexCursor(RangeCursor cursor, ValueAdapter<V> adapter)
           
 
Method Summary
 EntityCursor<V> dup()
          Duplicates the cursor at the cursor position.
 V nextDup(LockMode lockMode)
          Moves the cursor to the next value with the same key (duplicate) and returns it, or returns null if no more values are present for the key at the current position.
 V nextNoDup(LockMode lockMode)
          Moves the cursor to the next value with a different key and returns it, or returns null if there are no more unique keys in the cursor range.
 V prevDup(LockMode lockMode)
          Moves the cursor to the previous value with the same key (duplicate) and returns it, or returns null if no preceding values are present for the key at the current position.
 V prevNoDup(LockMode lockMode)
          Moves the cursor to the preceding value with a different key and returns it, or returns null if there are no preceding unique keys in the cursor range.
 
Methods inherited from class com.sleepycat.persist.BasicCursor
checkInitialized, close, count, current, current, delete, first, first, iterator, iterator, last, last, next, next, nextDup, nextNoDup, prev, prev, prevDup, prevNoDup, returnValue, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubIndexCursor

SubIndexCursor(RangeCursor cursor,
               ValueAdapter<V> adapter)
Method Detail

dup

public EntityCursor<V> dup()
                    throws DatabaseException
Description copied from interface: EntityCursor
Duplicates the cursor at the cursor position. The returned cursor will be initially positioned at the same position as this current cursor, and will inherit this cursor's Transaction and CursorConfig.

Specified by:
dup in interface EntityCursor<V>
Overrides:
dup in class BasicCursor<V>
Returns:
the duplicated cursor.
Throws:
DatabaseException

nextDup

public V nextDup(LockMode lockMode)
          throws DatabaseException
Description copied from interface: EntityCursor
Moves the cursor to the next value with the same key (duplicate) and returns it, or returns null if no more values are present for the key at the current position.

Specified by:
nextDup in interface EntityCursor<V>
Overrides:
nextDup in class BasicCursor<V>
Parameters:
lockMode - the lock mode to use for this operation, or null to use LockMode.DEFAULT.
Returns:
the next value with the same key, or null if no more values are present for the key at the current position.
Throws:
DatabaseException

nextNoDup

public V nextNoDup(LockMode lockMode)
            throws DatabaseException
Description copied from interface: EntityCursor
Moves the cursor to the next value with a different key and returns it, or returns null if there are no more unique keys in the cursor range. If the cursor is uninitialized, this method is equivalent to EntityCursor.first().

Specified by:
nextNoDup in interface EntityCursor<V>
Overrides:
nextNoDup in class BasicCursor<V>
Parameters:
lockMode - the lock mode to use for this operation, or null to use LockMode.DEFAULT.
Returns:
the next value with a different key, or null if there are no more unique keys in the cursor range.
Throws:
DatabaseException

prevDup

public V prevDup(LockMode lockMode)
          throws DatabaseException
Description copied from interface: EntityCursor
Moves the cursor to the previous value with the same key (duplicate) and returns it, or returns null if no preceding values are present for the key at the current position.

Specified by:
prevDup in interface EntityCursor<V>
Overrides:
prevDup in class BasicCursor<V>
Parameters:
lockMode - the lock mode to use for this operation, or null to use LockMode.DEFAULT.
Returns:
the previous value with the same key, or null if no preceding values are present for the key at the current position.
Throws:
DatabaseException

prevNoDup

public V prevNoDup(LockMode lockMode)
            throws DatabaseException
Description copied from interface: EntityCursor
Moves the cursor to the preceding value with a different key and returns it, or returns null if there are no preceding unique keys in the cursor range. If the cursor is uninitialized, this method is equivalent to EntityCursor.last().

Specified by:
prevNoDup in interface EntityCursor<V>
Overrides:
prevNoDup in class BasicCursor<V>
Parameters:
lockMode - the lock mode to use for this operation, or null to use LockMode.DEFAULT.
Returns:
the previous value with a different key, or null if there are no preceding unique keys in the cursor range.
Throws:
DatabaseException


Copyright 2004-2006 Sleepycat, Inc. All Rights Reserved.