|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.persist.BasicCursor<V>
class BasicCursor<V>
Implements EntityCursor and uses a ValueAdapter so that it can enumerate either keys or entities.
Field Summary | |
---|---|
(package private) ValueAdapter<V> |
adapter
|
(package private) RangeCursor |
cursor
|
(package private) DatabaseEntry |
data
|
(package private) DatabaseEntry |
key
|
(package private) DatabaseEntry |
pkey
|
(package private) boolean |
updateAllowed
|
Constructor Summary | |
---|---|
BasicCursor(RangeCursor cursor,
ValueAdapter<V> adapter,
boolean updateAllowed)
|
Method Summary | |
---|---|
(package private) void |
checkInitialized()
|
void |
close()
Closes the cursor. |
int |
count()
Returns the number of values (duplicates) for the key at the cursor position, or returns zero if all values for the key have been deleted. |
long |
countEstimate()
Returns a rough estimate of the number of values (duplicates) for the key at the cursor position, or returns zero if all values for the key have been deleted. |
V |
current()
Returns the value at the cursor position, or null if the value at the cursor position has been deleted. |
V |
current(LockMode lockMode)
Returns the value at the cursor position, or null if the value at the cursor position has been deleted. |
boolean |
delete()
Deletes the entity at the cursor position. |
EntityCursor<V> |
dup()
Duplicates the cursor at the cursor position. |
V |
first()
Moves the cursor to the first value and returns it, or returns null if the cursor range is empty. |
V |
first(LockMode lockMode)
Moves the cursor to the first value and returns it, or returns null if the cursor range is empty. |
CacheMode |
getCacheMode()
Returns the CacheMode used for operations performed using this
cursor. |
Iterator<V> |
iterator()
Returns an iterator over the key range, starting with the value following the current position or at the first value if the cursor is uninitialized. |
Iterator<V> |
iterator(LockMode lockMode)
Returns an iterator over the key range, starting with the value following the current position or at the first value if the cursor is uninitialized. |
V |
last()
Moves the cursor to the last value and returns it, or returns null if the cursor range is empty. |
V |
last(LockMode lockMode)
Moves the cursor to the last value and returns it, or returns null if the cursor range is empty. |
V |
next()
Moves the cursor to the next value and returns it, or returns null if there are no more values in the cursor range. |
V |
next(LockMode lockMode)
Moves the cursor to the next value and returns it, or returns null if there are no more values in the cursor range. |
V |
nextDup()
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 |
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()
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 |
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 |
prev()
Moves the cursor to the previous value and returns it, or returns null if there are no preceding values in the cursor range. |
V |
prev(LockMode lockMode)
Moves the cursor to the previous value and returns it, or returns null if there are no preceding values in the cursor range. |
V |
prevDup()
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 |
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()
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. |
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. |
(package private) V |
returnValue(OperationStatus status)
|
void |
setCacheMode(CacheMode cacheMode)
Changes the CacheMode used for operations performed using this
cursor. |
boolean |
update(V entity)
Replaces the entity at the cursor position with the given entity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
RangeCursor cursor
ValueAdapter<V> adapter
boolean updateAllowed
DatabaseEntry key
DatabaseEntry pkey
DatabaseEntry data
Constructor Detail |
---|
BasicCursor(RangeCursor cursor, ValueAdapter<V> adapter, boolean updateAllowed)
Method Detail |
---|
public V first() throws DatabaseException
EntityCursor
LockMode.DEFAULT
is used implicitly.
first
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V first(LockMode lockMode) throws DatabaseException
EntityCursor
first
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V last() throws DatabaseException
EntityCursor
LockMode.DEFAULT
is used implicitly.
last
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V last(LockMode lockMode) throws DatabaseException
EntityCursor
last
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V next() throws DatabaseException
EntityCursor
EntityCursor.first()
.
LockMode.DEFAULT
is used implicitly.
next
in interface EntityCursor<V>
next
in interface ForwardCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V next(LockMode lockMode) throws DatabaseException
EntityCursor
EntityCursor.first()
.
next
in interface EntityCursor<V>
next
in interface ForwardCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V nextDup() throws DatabaseException
EntityCursor
LockMode.DEFAULT
is used implicitly.
nextDup
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V nextDup(LockMode lockMode) throws DatabaseException
EntityCursor
nextDup
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V nextNoDup() throws DatabaseException
EntityCursor
EntityCursor.first()
.
LockMode.DEFAULT
is used implicitly.
nextNoDup
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V nextNoDup(LockMode lockMode) throws DatabaseException
EntityCursor
EntityCursor.first()
.
nextNoDup
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V prev() throws DatabaseException
EntityCursor
EntityCursor.last()
.
LockMode.DEFAULT
is used implicitly.
prev
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V prev(LockMode lockMode) throws DatabaseException
EntityCursor
EntityCursor.last()
.
prev
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V prevDup() throws DatabaseException
EntityCursor
LockMode.DEFAULT
is used implicitly.
prevDup
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V prevDup(LockMode lockMode) throws DatabaseException
EntityCursor
prevDup
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V prevNoDup() throws DatabaseException
EntityCursor
EntityCursor.last()
.
LockMode.DEFAULT
is used implicitly.
prevNoDup
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V prevNoDup(LockMode lockMode) throws DatabaseException
EntityCursor
EntityCursor.last()
.
prevNoDup
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V current() throws DatabaseException
EntityCursor
LockMode.DEFAULT
is used implicitly.
current
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public V current(LockMode lockMode) throws DatabaseException
EntityCursor
current
in interface EntityCursor<V>
lockMode
- the lock mode to use for this operation, or null to
use LockMode.DEFAULT
.
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public int count() throws DatabaseException
EntityCursor
The cost of this method is directly proportional to the number of values.
LockMode.DEFAULT
is used implicitly.
count
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public long countEstimate() throws DatabaseException
EntityCursor
If the underlying index has non-unique keys, a quick estimate of the
number of values is computed using information in the Btree. Because
the Btree is unbalanced, in some cases the estimate may be off by a
factor of two or more. The estimate is accurate when the number of
records is less than the configured NodeMaxEntries
.
The cost of this method is fixed, rather than being proportional to
the number of values. Because its accuracy is variable, this method
should normally be used when accuracy is not required, such as for query
optimization, and a fixed cost operation is needed. For example, this
method is used internally for determining the index processing order in
an EntityJoin
.
countEstimate
in interface EntityCursor<V>
OperationFailureException
- if one of the Read Operation
Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public Iterator<V> iterator()
EntityCursor
LockMode.DEFAULT
is used implicitly.
iterator
in interface EntityCursor<V>
iterator
in interface ForwardCursor<V>
iterator
in interface Iterable<V>
public Iterator<V> iterator(LockMode lockMode)
EntityCursor
iterator
in interface EntityCursor<V>
iterator
in interface ForwardCursor<V>
lockMode
- the lock mode to use for all operations performed
using the iterator, or null to use LockMode.DEFAULT
.
public boolean update(V entity) throws DatabaseException
EntityCursor
update
in interface EntityCursor<V>
entity
- the entity to replace the entity at the current position.
OperationFailureException
- if one of the Write
Operation Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public boolean delete() throws DatabaseException
EntityCursor
delete
in interface EntityCursor<V>
OperationFailureException
- if one of the Write
Operation Failures occurs.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.
DatabaseException
- the base class for all BDB exceptions.public EntityCursor<V> dup() throws DatabaseException
EntityCursor
Transaction
and CursorConfig
.
dup
in interface EntityCursor<V>
DatabaseException
- the base class for all BDB exceptions.public void close() throws DatabaseException
EntityCursor
close
in interface EntityCursor<V>
close
in interface ForwardCursor<V>
close
in interface Closeable
DatabaseException
- the base class for all BDB exceptions.public void setCacheMode(CacheMode cacheMode)
EntityCursor
CacheMode
used for operations performed using this
cursor. For a newly opened cursor, the default is CacheMode.DEFAULT
.
setCacheMode
in interface EntityCursor<V>
cacheMode
- is the CacheMode
to use for subsequent
operations using this cursor.CacheMode
public CacheMode getCacheMode()
EntityCursor
CacheMode
used for operations performed using this
cursor. For a newly opened cursor, the default is CacheMode.DEFAULT
.
getCacheMode
in interface EntityCursor<V>
CacheMode
void checkInitialized() throws IllegalStateException
IllegalStateException
V returnValue(OperationStatus status)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |