/** * @param key must not be null * @return <0 if less than start, 0 if equal (in range), >0 if higher (in range) */ int startRangeCompare(byte[] key) { byte[] start = mStart; return start == null ? 1 : startRangeCompare(start, key); }
/** * @param key must not be null * @return <0 if less than start, 0 if equal (in range), >0 if higher (in range) */ int startRangeCompare(byte[] key) { byte[] start = mStart; return start == null ? 1 : startRangeCompare(start, key); }
/** * @param key must not be null * @return {@literal <0 if less than start, 0 if equal (in range), >0 if higher (in range)} */ int startRangeCompare(byte[] key) { byte[] start = mStart; return start == null ? 1 : startRangeCompare(start, key); }
byte[] adjustLowKey(byte[] lowKey) { byte[] start = mStart; if (start != null && (lowKey == null || startRangeCompare(start, lowKey) < 0)) { lowKey = start; if ((mMode & START_EXCLUSIVE) != 0) { // Switch to exclusive start behavior. lowKey = ViewUtils.appendZero(lowKey); } } return lowKey; }
byte[] adjustLowKey(byte[] lowKey) { byte[] start = mStart; if (start != null && (lowKey == null || startRangeCompare(start, lowKey) < 0)) { lowKey = start; if ((mMode & START_EXCLUSIVE) != 0) { // Switch to exclusive start behavior. lowKey = ViewUtils.appendZero(lowKey); } } return lowKey; }
byte[] adjustLowKey(byte[] lowKey) { byte[] start = mStart; if (start != null && (lowKey == null || startRangeCompare(start, lowKey) < 0)) { lowKey = start; if ((mMode & START_EXCLUSIVE) != 0) { // Switch to exclusive start behavior. lowKey = ViewUtils.appendZero(lowKey); } } return lowKey; }
@Override boolean inRange(byte[] key) { return startRangeCompare(key) >= 0 && endRangeCompare(key) <= 0; }
@Override boolean inRange(byte[] key) { return startRangeCompare(key) >= 0 && endRangeCompare(key) <= 0; }
@Override public View viewGt(byte[] key) { keyCheck(key); if (startRangeCompare(key) < 0) { return this; } return new BoundedView(mSource, key, mEnd, mMode | START_EXCLUSIVE); }
@Override public View viewGe(byte[] key) { keyCheck(key); if (startRangeCompare(key) <= 0) { return this; } return new BoundedView(mSource, key, mEnd, mMode & ~START_EXCLUSIVE); }
@Override public View viewGt(byte[] key) { keyCheck(key); if (startRangeCompare(key) < 0) { return this; } return new BoundedView(mSource, key, mEnd, mMode | START_EXCLUSIVE); }
@Override public LockResult previousGe(byte[] limitKey) throws IOException { if (mView.startRangeCompare(limitKey) >= 0) { LockResult result = mSource.previousGe(limitKey); mOutOfBounds = false; return result; } else { return previous(); } }
@Override public LockResult previousGt(byte[] limitKey) throws IOException { if (mView.startRangeCompare(limitKey) >= 0) { return mSource.previousGt(limitKey); } else { return previous(); } }
@Override public LockResult previousGe(byte[] limitKey) throws IOException { if (mView.startRangeCompare(limitKey) >= 0) { return mSource.previousGe(limitKey); } else { return previous(); } }
@Override public LockResult previousGe(byte[] limitKey) throws IOException { if (mView.startRangeCompare(limitKey) >= 0) { return mSource.previousGe(limitKey); } else { return previous(); } }
@Override public LockResult previousGt(byte[] limitKey) throws IOException { if (mView.startRangeCompare(limitKey) >= 0) { return mSource.previousGt(limitKey); } else { return previous(); } }
@Override public View viewGe(byte[] key) { keyCheck(key); if (startRangeCompare(key) <= 0) { return this; } return new BoundedView(mSource, key, mEnd, mMode & ~START_EXCLUSIVE); }
@Override public LockResult previousGt(byte[] limitKey) throws IOException { if (mView.startRangeCompare(limitKey) >= 0) { LockResult result = mSource.previousGt(limitKey); mOutOfBounds = false; return result; } else { return previous(); } }
@Override public View viewGe(byte[] key) { keyCheck(key); if (startRangeCompare(key) <= 0) { return this; } return new BoundedView(mSource, key, mEnd, mMode & ~START_EXCLUSIVE); }
@Override public View viewGt(byte[] key) { keyCheck(key); if (startRangeCompare(key) < 0) { return this; } return new BoundedView(mSource, key, mEnd, mMode | START_EXCLUSIVE); }