sortedKeys.add(getCollatingValue(key)); if (ascSortOrder) Collections.sort(sortedKeys, ODefaultComparator.INSTANCE);
@Override public OIndexCursor iterateEntriesBetween(Object fromKey, final boolean fromInclusive, Object toKey, final boolean toInclusive, final boolean ascOrder) { final OTransactionIndexChanges indexChanges = database.getMicroOrRegularTransaction() .getIndexChangesInternal(delegate.getName()); if (indexChanges == null) return super.iterateEntriesBetween(fromKey, fromInclusive, toKey, toInclusive, ascOrder); fromKey = getCollatingValue(fromKey); toKey = getCollatingValue(toKey); final OIndexCursor txCursor; if (ascOrder) txCursor = new PureTxBetweenIndexForwardCursor(fromKey, fromInclusive, toKey, toInclusive, indexChanges); else txCursor = new PureTxBetweenIndexBackwardCursor(fromKey, fromInclusive, toKey, toInclusive, indexChanges); if (indexChanges.cleared) return txCursor; final OIndexCursor backedCursor = super.iterateEntriesBetween(fromKey, fromInclusive, toKey, toInclusive, ascOrder); return new OIndexTxCursor(txCursor, backedCursor, ascOrder, indexChanges); }
@Override public OIndexCursor iterateEntriesMinor(Object toKey, boolean toInclusive, boolean ascOrder) { final OTransactionIndexChanges indexChanges = database.getMicroOrRegularTransaction() .getIndexChangesInternal(delegate.getName()); if (indexChanges == null) return super.iterateEntriesMinor(toKey, toInclusive, ascOrder); toKey = getCollatingValue(toKey); final OIndexCursor txCursor; final Object firstKey = indexChanges.getFirstKey(); if (ascOrder) txCursor = new PureTxBetweenIndexForwardCursor(firstKey, true, toKey, toInclusive, indexChanges); else txCursor = new PureTxBetweenIndexBackwardCursor(firstKey, true, toKey, toInclusive, indexChanges); if (indexChanges.cleared) return txCursor; final OIndexCursor backedCursor = super.iterateEntriesMinor(toKey, toInclusive, ascOrder); return new OIndexTxCursor(txCursor, backedCursor, ascOrder, indexChanges); }
@Override public OIndexCursor iterateEntriesMajor(Object fromKey, boolean fromInclusive, boolean ascOrder) { final OTransactionIndexChanges indexChanges = database.getMicroOrRegularTransaction() .getIndexChangesInternal(delegate.getName()); if (indexChanges == null) return super.iterateEntriesMajor(fromKey, fromInclusive, ascOrder); fromKey = getCollatingValue(fromKey); final OIndexCursor txCursor; final Object lastKey = indexChanges.getLastKey(); if (ascOrder) txCursor = new PureTxBetweenIndexForwardCursor(fromKey, fromInclusive, lastKey, true, indexChanges); else txCursor = new PureTxBetweenIndexBackwardCursor(fromKey, fromInclusive, lastKey, true, indexChanges); if (indexChanges.cleared) return txCursor; final OIndexCursor backedCursor = super.iterateEntriesMajor(fromKey, fromInclusive, ascOrder); return new OIndexTxCursor(txCursor, backedCursor, ascOrder, indexChanges); }