Class PackBitmapIndexRemapper
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.PackBitmapIndex
-
- org.eclipse.jgit.internal.storage.file.PackBitmapIndexRemapper
-
- All Implemented Interfaces:
java.lang.Iterable<PackBitmapIndexRemapper.Entry>
public class PackBitmapIndexRemapper extends PackBitmapIndex implements java.lang.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 Classes Modifier and Type Class Description static class
PackBitmapIndexRemapper.Entry
An entry in the old PackBitmapIndex.
-
Field Summary
Fields Modifier and Type Field Description private BitSet
inflated
(package private) PackBitmapIndex
newPackIndex
private BasePackBitmapIndex
oldPackIndex
private int[]
prevToNewMapping
-
Fields inherited from class org.eclipse.jgit.internal.storage.file.PackBitmapIndex
FLAG_REUSE, packChecksum
-
-
Constructor Summary
Constructors Modifier Constructor Description private
PackBitmapIndexRemapper(BasePackBitmapIndex oldPackIndex, PackBitmapIndex newPackIndex)
private
PackBitmapIndexRemapper(PackBitmapIndex newPackIndex)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
findPosition(AnyObjectId objectId)
Finds the position in the bitmap of the object.com.googlecode.javaewah.EWAHCompressedBitmap
getBitmap(AnyObjectId objectId)
Returns the previously constructed bitmap for the object.int
getBitmapCount()
Returns the number of bitmaps in this bitmap index.ObjectId
getObject(int position)
Get the object at the bitmap position.int
getObjectCount()
Obtain the total number of objects described by this index.java.util.Iterator<PackBitmapIndexRemapper.Entry>
iterator()
static PackBitmapIndexRemapper
newPackBitmapIndex(BitmapIndex prevBitmapIndex, PackBitmapIndex newIndex)
A PackBitmapIndex that maps the positions in the prevBitmapIndex to the ones in the newIndex.com.googlecode.javaewah.EWAHCompressedBitmap
ofObjectType(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type)
Returns a bitmap containing positions for objects that have the given Git type.-
Methods inherited from class org.eclipse.jgit.internal.storage.file.PackBitmapIndex
open, read
-
-
-
-
Field Detail
-
oldPackIndex
private final BasePackBitmapIndex oldPackIndex
-
newPackIndex
final PackBitmapIndex newPackIndex
-
inflated
private final BitSet inflated
-
prevToNewMapping
private final int[] prevToNewMapping
-
-
Constructor Detail
-
PackBitmapIndexRemapper
private PackBitmapIndexRemapper(PackBitmapIndex newPackIndex)
-
PackBitmapIndexRemapper
private PackBitmapIndexRemapper(BasePackBitmapIndex oldPackIndex, PackBitmapIndex newPackIndex)
-
-
Method Detail
-
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
public int findPosition(AnyObjectId objectId)
Finds the position in the bitmap of the object.- Specified by:
findPosition
in classPackBitmapIndex
- 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
public ObjectId getObject(int position) throws java.lang.IllegalArgumentException
Get the object at the bitmap position.- Specified by:
getObject
in classPackBitmapIndex
- Parameters:
position
- the id for which the object will be found.- Returns:
- the ObjectId.
- Throws:
java.lang.IllegalArgumentException
- when the item is not found.
-
getObjectCount
public int getObjectCount()
Obtain the total number of objects described by this index.getObjectCount() - 1
is the largest bit that will be set in a bitmap.- Specified by:
getObjectCount
in classPackBitmapIndex
- Returns:
- number of objects in this index, and likewise in the associated pack that this index was generated from.
-
ofObjectType
public com.googlecode.javaewah.EWAHCompressedBitmap ofObjectType(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type)
Returns a bitmap containing positions for objects that have the given Git type.- Specified by:
ofObjectType
in classPackBitmapIndex
- Parameters:
bitmap
- the object bitmap.type
- the Git type.- Returns:
- the object bitmap with only objects of the Git type.
-
iterator
public java.util.Iterator<PackBitmapIndexRemapper.Entry> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<PackBitmapIndexRemapper.Entry>
-
getBitmap
public com.googlecode.javaewah.EWAHCompressedBitmap getBitmap(AnyObjectId objectId)
Returns the previously constructed bitmap for the object.- Specified by:
getBitmap
in classPackBitmapIndex
- 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()
Returns the number of bitmaps in this bitmap index.- Specified by:
getBitmapCount
in classPackBitmapIndex
- Returns:
- the number of bitmaps in this bitmap index.
-
-