Class PackBitmapIndexBuilder
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.PackBitmapIndex
-
- org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder
-
public class PackBitmapIndexBuilder extends PackBitmapIndex
Helper for constructingPackBitmapIndex
es.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PackBitmapIndexBuilder.StoredEntry
Data object for the on disk representation of a bitmap entry.
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.internal.storage.file.PackBitmapIndex
FLAG_REUSE
-
-
Constructor Summary
Constructors Constructor Description PackBitmapIndexBuilder(java.util.List<ObjectToPack> byName)
Creates a PackBitmapIndex used for building the contents of an index file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBitmap(AnyObjectId objectId, com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int flags)
Stores the bitmap for the objectId.void
addBitmap(AnyObjectId objectId, BitmapIndex.Bitmap bitmap, int flags)
Stores the bitmap for the objectId.void
clearBitmaps()
Removes all the bitmaps entries added.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()
com.googlecode.javaewah.EWAHCompressedBitmap
getBlobs()
com.googlecode.javaewah.EWAHCompressedBitmap
getCommits()
java.lang.Iterable<PackBitmapIndexBuilder.StoredEntry>
getCompressedBitmaps()
ObjectId
getObject(int position)
Get the object at the bitmap position.int
getObjectCount()
Obtain the total number of objects described by this index.int
getOptions()
com.googlecode.javaewah.EWAHCompressedBitmap
getTags()
com.googlecode.javaewah.EWAHCompressedBitmap
getTrees()
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
-
-
-
-
Constructor Detail
-
PackBitmapIndexBuilder
public PackBitmapIndexBuilder(java.util.List<ObjectToPack> byName)
Creates a PackBitmapIndex used for building the contents of an index file.- Parameters:
byName
- objects sorted by name.
-
-
Method Detail
-
addBitmap
public void addBitmap(AnyObjectId objectId, BitmapIndex.Bitmap bitmap, int flags)
Stores the bitmap for the objectId.- Parameters:
objectId
- the object id key for the bitmap.bitmap
- the bitmapflags
- the flags to be stored with the bitmap
-
addBitmap
public void addBitmap(AnyObjectId objectId, com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int flags)
Stores the bitmap for the objectId.- Parameters:
objectId
- the object id key for the bitmap.bitmap
- the bitmapflags
- the flags to be stored with the bitmap
-
ofObjectType
public com.googlecode.javaewah.EWAHCompressedBitmap ofObjectType(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type)
Description copied from class:PackBitmapIndex
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.
-
findPosition
public int findPosition(AnyObjectId objectId)
Description copied from class:PackBitmapIndex
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
Description copied from class:PackBitmapIndex
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.
-
getCommits
public com.googlecode.javaewah.EWAHCompressedBitmap getCommits()
- Returns:
- the commit object bitmap.
-
getTrees
public com.googlecode.javaewah.EWAHCompressedBitmap getTrees()
- Returns:
- the tree object bitmap.
-
getBlobs
public com.googlecode.javaewah.EWAHCompressedBitmap getBlobs()
- Returns:
- the blob object bitmap.
-
getTags
public com.googlecode.javaewah.EWAHCompressedBitmap getTags()
- Returns:
- the tag object bitmap.
-
getOptions
public int getOptions()
- Returns:
- the index storage options.
-
getBitmapCount
public int getBitmapCount()
- Returns:
- the number of bitmaps.
-
clearBitmaps
public void clearBitmaps()
Removes all the bitmaps entries added.
-
getObjectCount
public int getObjectCount()
Description copied from class:PackBitmapIndex
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.
-
getCompressedBitmaps
public java.lang.Iterable<PackBitmapIndexBuilder.StoredEntry> getCompressedBitmaps()
- Returns:
- an iterator over the xor compressed entries.
-
getBitmap
public com.googlecode.javaewah.EWAHCompressedBitmap getBitmap(AnyObjectId objectId)
Description copied from class:PackBitmapIndex
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.
-
-