ByteKeyRangeTracker implements RangeTracker<ByteKey> { @Override public synchronized double getFractionConsumed() { if (position == null) { return 0; } else if (done) { return 1.0; } else if (position.compareTo(range.getEndKey()) >= 0) { return 1.0; } return range.estimateFractionForKey(position); } private  ByteKeyRangeTracker(ByteKeyRange range); static ByteKeyRangeTracker of(ByteKeyRange range); synchronized boolean isDone(); @Override synchronized ByteKey getStartPosition(); @Override synchronized ByteKey getStopPosition(); synchronized ByteKeyRange getRange(); @Override synchronized boolean tryReturnRecordAt(boolean isAtSplitPoint, ByteKey recordStart); @Override synchronized boolean trySplitAtPosition(ByteKey splitPosition); @Override synchronized double getFractionConsumed(); synchronized long getSplitPointsConsumed(); synchronized boolean markDone(); @Override synchronized String toString();  }
@Test public void testGetFractionConsumed() { ByteKeyRangeTracker tracker = ByteKeyRangeTracker.of(INITIAL_RANGE); double delta = 0.00001; assertEquals(0.0, tracker.getFractionConsumed(), delta); tracker.tryReturnRecordAt(true, INITIAL_START_KEY); assertEquals(0.0, tracker.getFractionConsumed(), delta); tracker.tryReturnRecordAt(true, INITIAL_MIDDLE_KEY); assertEquals(0.5, tracker.getFractionConsumed(), delta); tracker.tryReturnRecordAt(true, BEFORE_END_KEY); assertEquals(1 - 1 / INITIAL_RANGE_SIZE, tracker.getFractionConsumed(), delta); }