コード例 #1
0
 private EntitiesOfTypeIterator(
     @NotNull final EntitiesOfTypeRangeIterable iterable, @NotNull final Cursor index) {
   super(iterable);
   setCursor(index);
   final ByteIterable key = LongBinding.longToCompressedEntry(min);
   checkHasNext(getCursor().getSearchKeyRange(key) != null);
 }
コード例 #2
0
 @Override
 protected long countImpl(@NotNull final PersistentStoreTransaction txn) {
   final Cursor cursor = openCursor(txn);
   if (cursor == null) {
     return 0;
   }
   try {
     final ByteIterable key = LongBinding.longToCompressedEntry(min);
     long result = 0;
     boolean success = cursor.getSearchKeyRange(key) != null;
     while (success) {
       if (max > LongBinding.compressedEntryToLong(cursor.getKey())) {
         break;
       }
       result++;
       success = cursor.getNextNoDup();
     }
     return result;
   } finally {
     cursor.close();
   }
 }