Module org.eclipse.jgit
Class PackBitmapIndexRemapper
java.lang.Object
org.eclipse.jgit.internal.storage.file.PackBitmapIndexRemapper
- All Implemented Interfaces:
Iterable<PackBitmapIndexRemapper.Entry>,PackBitmapIndex
public class PackBitmapIndexRemapper
extends Object
implements PackBitmapIndex, Iterable<PackBitmapIndexRemapper.Entry>
A PackBitmapIndex that remaps the bitmaps in the previous index to the
positions in the new pack index. Note, unlike typical PackBitmapIndex
implementations this implementation is not thread safe, as it is intended to
be used with a PackBitmapIndexBuilder, which is also not thread safe.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn entry in the old PackBitmapIndex.Nested classes/interfaces inherited from interface org.eclipse.jgit.internal.storage.file.PackBitmapIndex
PackBitmapIndex.SupplierWithIOException<T> -
Field Summary
Fields inherited from interface org.eclipse.jgit.internal.storage.file.PackBitmapIndex
FLAG_REUSE -
Method Summary
Modifier and TypeMethodDescriptionintfindPosition(AnyObjectId objectId) Finds the position in the bitmap of the object.intReturns the number of bitmaps in this bitmap index ready to use, not XOR'ed against other entries.longCurrent size in bytes of all base bitmaps in the index.com.googlecode.javaewah.EWAHCompressedBitmapgetBitmap(AnyObjectId objectId) Returns the previously constructed bitmap for the object.intReturns the number of bitmaps in this bitmap index.getObject(int position) Get the object at the bitmap position.intObtain the total number of objects described by this index.intReturns the number of bitmaps in this bitmap index XOR'ed against other entries.longCurrent size in bytes of all XOR'ed bitmaps in the index.iterator()static PackBitmapIndexRemappernewPackBitmapIndex(BitmapIndex prevBitmapIndex, PackBitmapIndex newIndex) A PackBitmapIndex that maps the positions in the prevBitmapIndex to the ones in the newIndex.com.googlecode.javaewah.EWAHCompressedBitmapofObjectType(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type) Returns a bitmap containing positions for objects that have the given Git type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.eclipse.jgit.internal.storage.file.PackBitmapIndex
getPackChecksum
-
Method Details
-
newPackBitmapIndex
public static PackBitmapIndexRemapper newPackBitmapIndex(BitmapIndex prevBitmapIndex, PackBitmapIndex newIndex) A PackBitmapIndex that maps the positions in the prevBitmapIndex to the ones in the newIndex.- Parameters:
prevBitmapIndex- the bitmap index with the old mapping.newIndex- the bitmap index with the new mapping.- Returns:
- a bitmap index that attempts to do the mapping between the two.
-
findPosition
Description copied from interface:PackBitmapIndexFinds the position in the bitmap of the object.- Specified by:
findPositionin interfacePackBitmapIndex- Parameters:
objectId- the id for which the bitmap position will be found.- Returns:
- the bitmap id or -1 if the object was not found.
-
getObject
Description copied from interface:PackBitmapIndexGet the object at the bitmap position.- Specified by:
getObjectin interfacePackBitmapIndex- Parameters:
position- the offset in the bitmap which corresponds to an object of interest. This position is the same as the order of the object in thePackFile.- Returns:
- the ObjectId.
- Throws:
IllegalArgumentException- when the item is not found.
-
getObjectCount
public int getObjectCount()Description copied from interface:PackBitmapIndexObtain the total number of objects described by this index.getObjectCount() - 1is the largest bit that will be set in a bitmap.- Specified by:
getObjectCountin interfacePackBitmapIndex- Returns:
- number of objects in this index, and likewise in the associated pack that this index was generated from.
-
getBaseBitmapCount
public int getBaseBitmapCount()Description copied from interface:PackBitmapIndexReturns the number of bitmaps in this bitmap index ready to use, not XOR'ed against other entries.- Specified by:
getBaseBitmapCountin interfacePackBitmapIndex- Returns:
- the number of bitmaps in this bitmap index ready to use.
-
getBaseBitmapSizeInBytes
public long getBaseBitmapSizeInBytes()Description copied from interface:PackBitmapIndexCurrent size in bytes of all base bitmaps in the index. Resolving xors for bitmaps can affect this size.- Specified by:
getBaseBitmapSizeInBytesin interfacePackBitmapIndex- Returns:
- Current size (in bytes) of all base bitmaps in this index.
-
getXorBitmapCount
public int getXorBitmapCount()Description copied from interface:PackBitmapIndexReturns the number of bitmaps in this bitmap index XOR'ed against other entries.- Specified by:
getXorBitmapCountin interfacePackBitmapIndex- Returns:
- the number of bitmaps in this bitmap index represented as XOR masks.
-
getXorBitmapSizeInBytes
public long getXorBitmapSizeInBytes()Description copied from interface:PackBitmapIndexCurrent size in bytes of all XOR'ed bitmaps in the index. Resolving xors for bitmaps can affect this size.- Specified by:
getXorBitmapSizeInBytesin interfacePackBitmapIndex- Returns:
- Current size (in bytes) of all xor bitmaps in this index.
-
ofObjectType
public com.googlecode.javaewah.EWAHCompressedBitmap ofObjectType(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type) Description copied from interface:PackBitmapIndexReturns a bitmap containing positions for objects that have the given Git type.- Specified by:
ofObjectTypein interfacePackBitmapIndex- Parameters:
bitmap- the object bitmap.type- the Git type.- Returns:
- the object bitmap with only objects of the Git type.
-
iterator
- Specified by:
iteratorin interfaceIterable<PackBitmapIndexRemapper.Entry>
-
getBitmap
Description copied from interface:PackBitmapIndexReturns the previously constructed bitmap for the object.- Specified by:
getBitmapin interfacePackBitmapIndex- Parameters:
objectId- the id for which the bitmap will be found.- Returns:
- the bitmap or null if the object was not found.
-
getBitmapCount
public int getBitmapCount()Description copied from interface:PackBitmapIndexReturns the number of bitmaps in this bitmap index.- Specified by:
getBitmapCountin interfacePackBitmapIndex- Returns:
- the number of bitmaps in this bitmap index.
-