use of org.cojen.tupl.LockResult in project Tupl by cojen.
the class TransformedCursor method findLt.
@Override
public LockResult findLt(final byte[] tkey) throws IOException {
final Cursor c = mSource;
LockResult result;
try {
byte[] key = inverseTransformKey(tkey);
if (key == null) {
key = mTransformer.inverseTransformKeyLt(tkey);
if (key == null) {
reset();
return LockResult.UNOWNED;
}
result = c.findLe(key);
} else {
result = c.findLt(key);
}
} catch (LockFailureException e) {
throw transformCurrent(e);
}
result = transformCurrent(result);
return result == null ? previous() : result;
}
use of org.cojen.tupl.LockResult in project Tupl by cojen.
the class TransformedCursor method findGt.
@Override
public LockResult findGt(final byte[] tkey) throws IOException {
final Cursor c = mSource;
LockResult result;
try {
byte[] key = inverseTransformKey(tkey);
if (key == null) {
key = mTransformer.inverseTransformKeyGt(tkey);
if (key == null) {
reset();
return LockResult.UNOWNED;
}
result = c.findGe(key);
} else {
result = c.findGt(key);
}
} catch (LockFailureException e) {
throw transformCurrent(e);
}
result = transformCurrent(result);
return result == null ? next() : result;
}
use of org.cojen.tupl.LockResult in project Tupl by cojen.
the class TransformedCursor method last.
@Override
public LockResult last() throws IOException {
LockResult result;
try {
result = mSource.last();
} catch (LockFailureException e) {
throw transformCurrent(e);
}
result = transformCurrent(result);
return result == null ? previous() : result;
}
use of org.cojen.tupl.LockResult in project Tupl by cojen.
the class TransformedCursor method previousGt.
@Override
public LockResult previousGt(final byte[] limitTKey) throws IOException {
final Cursor c = mSource;
LockResult result;
byte[] limitKey = inverseTransformKey(limitTKey);
if (limitKey == null) {
limitKey = mTransformer.inverseTransformKeyGt(limitTKey);
if (limitKey == null) {
reset();
return LockResult.UNOWNED;
}
while (true) {
try {
result = c.previousGe(limitKey);
} catch (LockFailureException e) {
throw transformCurrent(e);
}
result = transformCurrent(result);
if (result != null) {
return result;
}
}
} else {
while (true) {
try {
result = c.previousGt(limitKey);
} catch (LockFailureException e) {
throw transformCurrent(e);
}
result = transformCurrent(result);
if (result != null) {
return result;
}
}
}
}
use of org.cojen.tupl.LockResult in project Tupl by cojen.
the class TransformedCursor method next.
@Override
public LockResult next() throws IOException {
final Cursor c = mSource;
while (true) {
LockResult result;
try {
result = c.next();
} catch (LockFailureException e) {
throw transformCurrent(e);
}
result = transformCurrent(result);
if (result != null) {
return result;
}
}
}
Aggregations