core/src/main/java/com/orientechnologies/orient/core/index/OIndexChangesWrapper.java
public static OIndexCursor wrap(OIndex<?> source, OIndexCursor cursor, long indexRebuildVersion) {
    if (cursor instanceof OIndexChangesWrapper)
      return cursor;

    if (cursor instanceof OSizeable) {
      return new OIndexChangesSizeable(source, cursor, indexRebuildVersion);
    }

    return new OIndexChangesWrapper(source, cursor, indexRebuildVersion);
  }
public static OIndexCursor wrap(OIndex<?> source, OIndexCursor cursor, long indexRebuildVersion) {
    if (cursor instanceof OIndexChangesWrapper)
      return cursor;

    if (cursor instanceof OSizeable) {
      return new OIndexChangesSizeable(source, cursor, indexRebuildVersion);
    }

    return new OIndexChangesWrapper(source, cursor, indexRebuildVersion);
  }
Wraps courser only if it is not already wrapped.

@param source              Index which is used to create given cursor.
@param cursor              Cursor to wrap.
@param indexRebuildVersion Rebuild version of index <b>before</b> cursor was created.
@return Wrapped cursor.
@see OIndex#getRebuildVersion()