K
- Type of the simulated record's keyV
- Type of the simulated record's valuepublic final class EmptyCursor<K,V> extends Object implements Cursor<K,V>
Cursor
, for simulating no records to cursor on.
Cursor behaves as follows:
false
.null
.UnsupportedOperationException
will be thrown.Constructor and Description |
---|
EmptyCursor() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
delete()
Deletes the record on which this cursor is currently positioned.
|
K |
getKey()
Returns the key of the record on which this cursor is currently positioned.
|
V |
getValue()
Returns the value of the record on which this cursor is currently positioned.
|
boolean |
isDefined()
Check whether this cursor is currently pointing to valid record.
|
boolean |
next()
Moves this cursor to the next record in the tree.
|
boolean |
positionToIndex(int index)
Positions the cursor to the specified index within the tree.
|
boolean |
positionToKey(org.forgerock.opendj.ldap.ByteSequence key)
Positions the cursor to the provided key if it exists in the tree.
|
boolean |
positionToKeyOrNext(org.forgerock.opendj.ldap.ByteSequence key)
Positions the cursor to the provided key if it exists in the tree,
or else the lesser key greater than the provided key in the tree.
|
boolean |
positionToLastKey()
Positions the cursor to the last key in the tree.
|
public EmptyCursor()
public boolean positionToKey(org.forgerock.opendj.ldap.ByteSequence key)
Cursor
positionToKey
in interface Cursor<K,V>
key
- the key where to position the cursortrue
if the cursor could be positioned to the key,
false
otherwisepublic boolean positionToKeyOrNext(org.forgerock.opendj.ldap.ByteSequence key)
Cursor
positionToKeyOrNext
in interface Cursor<K,V>
key
- the key where to position the cursortrue
if the cursor could be positioned to the key
or the next one, false
otherwisepublic boolean positionToLastKey()
Cursor
positionToLastKey
in interface Cursor<K,V>
true
if the cursor could be positioned to the last key,
false
otherwisepublic boolean positionToIndex(int index)
Cursor
positionToIndex
in interface Cursor<K,V>
index
- the index where the cursor should be positioned, (0 is the first record).true
if the cursor could be positioned to the index, false
otherwisepublic boolean next()
SequentialCursor
next
in interface SequentialCursor<K,V>
true
if the cursor has moved to the next record,
false
if no next record exists leaving cursor
in undefined state.public boolean isDefined()
SequentialCursor
isDefined
in interface SequentialCursor<K,V>
true
if the cursor is pointing to a valid entry,
false
if cursor is not pointing to a valid entrypublic K getKey() throws NoSuchElementException
SequentialCursor
getKey
in interface SequentialCursor<K,V>
NoSuchElementException
- if the cursor is not defined.public V getValue() throws NoSuchElementException
SequentialCursor
getValue
in interface SequentialCursor<K,V>
NoSuchElementException
- if the cursor is not defined.public void delete() throws NoSuchElementException, UnsupportedOperationException
SequentialCursor
SequentialCursor.next()
must be called in order to point to the next record. The behavior of
methods SequentialCursor.getKey()
and SequentialCursor.getValue()
after this method returns is undefined.delete
in interface SequentialCursor<K,V>
NoSuchElementException
- if the cursor is not defined.UnsupportedOperationException
- if the cursor implementation does not support updates.public void close()
SequentialCursor
close
in interface Closeable
close
in interface AutoCloseable
close
in interface SequentialCursor<K,V>
Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.