/** * Optimized version of the regular findLt method, which can perform fewer search steps if * the given key is in close proximity to the current one. Even if not in close proximity, * the find outcome is identical, although it may perform more slowly. * * <p>Ownership of the key instance transfers to the Cursor, and it must * not be modified after calling this method. * * @return {@link LockResult#UNOWNED UNOWNED}, {@link LockResult#ACQUIRED * ACQUIRED}, {@link LockResult#OWNED_SHARED OWNED_SHARED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws NullPointerException if key is null */ public default LockResult findNearbyLt(byte[] key) throws IOException { ViewUtils.findNearbyNoLock(this, key); return previous(); }
/** * Optimized version of the regular findGt method, which can perform fewer search steps if * the given key is in close proximity to the current one. Even if not in close proximity, * the find outcome is identical, although it may perform more slowly. * * <p>Ownership of the key instance transfers to the Cursor, and it must * not be modified after calling this method. * * @return {@link LockResult#UNOWNED UNOWNED}, {@link LockResult#ACQUIRED * ACQUIRED}, {@link LockResult#OWNED_SHARED OWNED_SHARED}, {@link * LockResult#OWNED_UPGRADABLE OWNED_UPGRADABLE}, or {@link * LockResult#OWNED_EXCLUSIVE OWNED_EXCLUSIVE} * @throws NullPointerException if key is null */ public default LockResult findNearbyGt(byte[] key) throws IOException { ViewUtils.findNearbyNoLock(this, key); return next(); }
@Override public LockResult findNearby(byte[] key) throws IOException { if (mView.inRange(key)) { LockResult result = mSource.findNearby(key); mOutOfBounds = false; return result; } else { mOutOfBounds = true; ViewUtils.findNearbyNoLock(mSource, key); return LockResult.UNOWNED; } }