Search in sources :

Example 1 with PropertyValue

use of jetbrains.exodus.entitystore.tables.PropertyValue in project xodus by JetBrains.

the class PropertyRangeIterable method countImpl.

@Override
protected long countImpl(@NotNull final PersistentStoreTransaction txn) {
    final Cursor cursor = openCursor(txn);
    if (cursor == null) {
        return 0;
    }
    try {
        final PropertyValue propertyValue = getStore().getPropertyTypes().dataToPropertyValue(min);
        final ComparableBinding binding = propertyValue.getBinding();
        long result = 0;
        boolean success = cursor.getSearchKeyRange(propertyValue.dataToEntry()) != null;
        while (success && max.compareTo(binding.entryToObject(cursor.getKey())) >= 0) {
            result += cursor.count();
            success = cursor.getNextNoDup();
        }
        return result;
    } finally {
        cursor.close();
    }
}
Also used : ComparableBinding(jetbrains.exodus.bindings.ComparableBinding) PropertyValue(jetbrains.exodus.entitystore.tables.PropertyValue) Cursor(jetbrains.exodus.env.Cursor)

Aggregations

ComparableBinding (jetbrains.exodus.bindings.ComparableBinding)1 PropertyValue (jetbrains.exodus.entitystore.tables.PropertyValue)1 Cursor (jetbrains.exodus.env.Cursor)1