int prev = nextIndex - 1;
boolean found = false;
if (keys[prev] == null) {
/* Get the first record for an uninitialized iterator. */
OperationStatus status = cursor.getFirst(false);
if (status == OperationStatus.SUCCESS) {
found = true;
nextIndex = 0;
}
} else {
/* Reposition to the last known key/data pair. */
int repos = cursor.repositionRange
(keys[prev], priKeys[prev], values[prev], false);
if (repos == DataCursor.REPOS_EXACT) {
/*
* The last known key/data pair was found and will now be
* in slot zero.
*/
found = true;
nextIndex = 1;
/* The data object is now in slot zero or not available. */
if (dataIndex == prev) {
dataIndex = 0;
} else {
dataIndex = -1;
dataObject = null;
}
} else if (repos == DataCursor.REPOS_NEXT) {
/*
* The last known key/data pair was not found, but the
* following record was found and it will be in slot zero.
*/
found = true;
nextIndex = 0;
/* The data object is no longer available. */
dataIndex = -1;
dataObject = null;
} else {
if (repos != DataCursor.REPOS_EOF) {
throw DbCompat.unexpectedState();
}
}
}
if (found) {
/* Clear all slots first in case an exception occurs below. */
clearSlots();
/* Attempt to fill all slots with records. */
int i = 0;
boolean done = false;
while (!done) {
setSlot(i, cursor);
i += 1;
if (i < keys.length) {
OperationStatus status = coll.iterateDuplicates() ?
cursor.getNext(false) :
cursor.getNextNoDup(false);
if (status != OperationStatus.SUCCESS) {
done = true;
}