if (l.compareTo(beginLocation) < 0) { throw new IllegalArgumentException( "Attempt to seek before the begin location."); if (l.compareTo(endLocation) > 0) { throw new IllegalArgumentException( "Attempt to seek after the end location."); if (l.compareTo(endLocation) == 0) { parkCursorAtEnd(); return; if (l.getBlockIndex() != currentLocation.getBlockIndex()) { initBlock(l.getBlockIndex()); } else { if (valueChecked) { if (l.getRecordIndex() < currentLocation.getRecordIndex()) { initBlock(l.getBlockIndex()); inBlockAdvance(l.getRecordIndex() - currentLocation.getRecordIndex());
valueDataInputStream = new DataInputStream(valueBufferInputStream); if (beginLocation.compareTo(endLocation) >= 0) { currentLocation = new Location(endLocation); } else { currentLocation = new Location(0, 0); initBlock(beginLocation.getBlockIndex()); inBlockAdvance(beginLocation.getRecordIndex());
int curBid = currentLocation.getBlockIndex(); long entryInBlock = reader.getBlockEntryCount(curBid); if (curBid == endLocation.getBlockIndex()) { entryInBlock = endLocation.getRecordIndex(); while (currentLocation.getRecordIndex() < entryInBlock) { int cmp = compareCursorKeyTo(key); if (cmp > 0) return false; currentLocation.incRecordIndex();
valueDataInputStream = new DataInputStream(valueBufferInputStream); if (beginLocation.compareTo(endLocation) >= 0) { currentLocation = new Location(endLocation); } else { currentLocation = new Location(0, 0); initBlock(beginLocation.getBlockIndex()); inBlockAdvance(beginLocation.getRecordIndex());
int curBid = currentLocation.getBlockIndex(); long entryInBlock = reader.getBlockEntryCount(curBid); if (curBid == endLocation.getBlockIndex()) { entryInBlock = endLocation.getRecordIndex(); while (currentLocation.getRecordIndex() < entryInBlock) { int cmp = compareCursorKeyTo(key); if (cmp > 0) return false; currentLocation.incRecordIndex();
int curBid = currentLocation.getBlockIndex(); long entryInBlock = reader.getBlockEntryCount(curBid); if (curBid == endLocation.getBlockIndex()) { entryInBlock = endLocation.getRecordIndex(); while (currentLocation.getRecordIndex() < entryInBlock) { int cmp = compareCursorKeyTo(key); if (cmp > 0) return false; currentLocation.incRecordIndex();
valueDataInputStream = new DataInputStream(valueBufferInputStream); if (beginLocation.compareTo(endLocation) >= 0) { currentLocation = new Location(endLocation); } else { currentLocation = new Location(0, 0); initBlock(beginLocation.getBlockIndex()); inBlockAdvance(beginLocation.getRecordIndex());
int curBid = currentLocation.getBlockIndex(); long entryInBlock = reader.getBlockEntryCount(curBid); if (curBid == endLocation.getBlockIndex()) { entryInBlock = endLocation.getRecordIndex(); while (currentLocation.getRecordIndex() < entryInBlock) { int cmp = compareCursorKeyTo(key); if (cmp > 0) return false; currentLocation.incRecordIndex();
valueDataInputStream = new DataInputStream(valueBufferInputStream); if (beginLocation.compareTo(endLocation) >= 0) { currentLocation = new Location(endLocation); } else { currentLocation = new Location(0, 0); initBlock(beginLocation.getBlockIndex()); inBlockAdvance(beginLocation.getRecordIndex());
valueDataInputStream = new DataInputStream(valueBufferInputStream); if (beginLocation.compareTo(endLocation) >= 0) { currentLocation = new Location(endLocation); } else { currentLocation = new Location(0, 0); initBlock(beginLocation.getBlockIndex()); inBlockAdvance(beginLocation.getRecordIndex());
int curBid = currentLocation.getBlockIndex(); long entryInBlock = reader.getBlockEntryCount(curBid); if (curBid == endLocation.getBlockIndex()) { entryInBlock = endLocation.getRecordIndex(); while (currentLocation.getRecordIndex() < entryInBlock) { int cmp = compareCursorKeyTo(key); if (cmp > 0) return false; currentLocation.incRecordIndex();
int curBid = currentLocation.getBlockIndex(); long entryInBlock = reader.getBlockEntryCount(curBid); if (curBid == endLocation.getBlockIndex()) { entryInBlock = endLocation.getRecordIndex(); while (currentLocation.getRecordIndex() < entryInBlock) { int cmp = compareCursorKeyTo(key); if (cmp > 0) return false; currentLocation.incRecordIndex();
/** * Move the cursor to the next key-value pair. The entry returned by the * previous entry() call will be invalid. * * @return true if the cursor successfully moves. False when cursor is * already at the end location and cannot be advanced. * @throws IOException */ public boolean advance() throws IOException { if (atEnd()) { return false; } int curBid = currentLocation.getBlockIndex(); long curRid = currentLocation.getRecordIndex(); long entriesInBlock = reader.getBlockEntryCount(curBid); if (curRid + 1 >= entriesInBlock) { if (endLocation.compareTo(curBid + 1, 0) <= 0) { // last entry in TFile. parkCursorAtEnd(); } else { // last entry in Block. initBlock(curBid + 1); } } else { inBlockAdvance(1); } return true; }
valueDataInputStream = new DataInputStream(valueBufferInputStream); if (beginLocation.compareTo(endLocation) >= 0) { currentLocation = new Location(endLocation); } else { currentLocation = new Location(0, 0); initBlock(beginLocation.getBlockIndex()); inBlockAdvance(beginLocation.getRecordIndex());
/** * Move the cursor to the next key-value pair. The entry returned by the * previous entry() call will be invalid. * * @return true if the cursor successfully moves. False when cursor is * already at the end location and cannot be advanced. * @throws IOException */ public boolean advance() throws IOException { if (atEnd()) { return false; } int curBid = currentLocation.getBlockIndex(); long curRid = currentLocation.getRecordIndex(); long entriesInBlock = reader.getBlockEntryCount(curBid); if (curRid + 1 >= entriesInBlock) { if (endLocation.compareTo(curBid + 1, 0) <= 0) { // last entry in TFile. parkCursorAtEnd(); } else { // last entry in Block. initBlock(curBid + 1); } } else { inBlockAdvance(1); } return true; }
/** * Move the cursor to the next key-value pair. The entry returned by the * previous entry() call will be invalid. * * @return true if the cursor successfully moves. False when cursor is * already at the end location and cannot be advanced. * @throws IOException */ public boolean advance() throws IOException { if (atEnd()) { return false; } int curBid = currentLocation.getBlockIndex(); long curRid = currentLocation.getRecordIndex(); long entriesInBlock = reader.getBlockEntryCount(curBid); if (curRid + 1 >= entriesInBlock) { if (endLocation.compareTo(curBid + 1, 0) <= 0) { // last entry in TFile. parkCursorAtEnd(); } else { // last entry in Block. initBlock(curBid + 1); } } else { inBlockAdvance(1); } return true; }
/** * Move the cursor to the next key-value pair. The entry returned by the * previous entry() call will be invalid. * * @return true if the cursor successfully moves. False when cursor is * already at the end location and cannot be advanced. * @throws IOException */ public boolean advance() throws IOException { if (atEnd()) { return false; } int curBid = currentLocation.getBlockIndex(); long curRid = currentLocation.getRecordIndex(); long entriesInBlock = reader.getBlockEntryCount(curBid); if (curRid + 1 >= entriesInBlock) { if (endLocation.compareTo(curBid + 1, 0) <= 0) { // last entry in TFile. parkCursorAtEnd(); } else { // last entry in Block. initBlock(curBid + 1); } } else { inBlockAdvance(1); } return true; }
/** * Move the cursor to the next key-value pair. The entry returned by the * previous entry() call will be invalid. * * @return true if the cursor successfully moves. False when cursor is * already at the end location and cannot be advanced. * @throws IOException */ public boolean advance() throws IOException { if (atEnd()) { return false; } int curBid = currentLocation.getBlockIndex(); long curRid = currentLocation.getRecordIndex(); long entriesInBlock = reader.getBlockEntryCount(curBid); if (curRid + 1 >= entriesInBlock) { if (endLocation.compareTo(curBid + 1, 0) <= 0) { // last entry in TFile. parkCursorAtEnd(); } else { // last entry in Block. initBlock(curBid + 1); } } else { inBlockAdvance(1); } return true; }
/** * if greater is true then returns the beginning location of the block * containing the key strictly greater than input key. if greater is false * then returns the beginning location of the block greater than equal to * the input key * * @param key * the input key * @param greater * boolean flag * @return * @throws IOException */ Location getBlockContainsKey(RawComparable key, boolean greater) throws IOException { if (!isSorted()) { throw new RuntimeException("Seeking in unsorted TFile"); } checkTFileDataIndex(); int blkIndex = (greater) ? tfileIndex.upperBound(key) : tfileIndex.lowerBound(key); if (blkIndex < 0) return end; return new Location(blkIndex, 0); }
/** * if greater is true then returns the beginning location of the block * containing the key strictly greater than input key. if greater is false * then returns the beginning location of the block greater than equal to * the input key * * @param key * the input key * @param greater * boolean flag * @return * @throws IOException */ Location getBlockContainsKey(RawComparable key, boolean greater) throws IOException { if (!isSorted()) { throw new RuntimeException("Seeking in unsorted TFile"); } checkTFileDataIndex(); int blkIndex = (greater) ? tfileIndex.upperBound(key) : tfileIndex.lowerBound(key); if (blkIndex < 0) return end; return new Location(blkIndex, 0); }