Make BitmapIndexImpl.CompressedBitmap public
PackWriterBitmapPreparer (which is in another package) is already well aware of the mapping between EWAHCompressedBitmaps and the higher-level CompressedBitmap objects of the BitmapIndexImpl API. Making the CompressedBitmap type public makes the translation more obvious and wouldn't break any abstractions that aren't already broken. So expose it. This is all under org.eclipse.jgit.internal so there are no API stability guarantees --- we can change the API if internals change (for example if some day there are bitmaps spanning multiple packs). In particular this means the confusing toBitmap helper can be removed. Change-Id: Ifb2e8804a6d5ee46e82a76d276c4f8507eaa2a4c
This commit is contained in:
parent
683bd09092
commit
86af34e150
|
@ -93,17 +93,6 @@ public CompressedBitmap getBitmap(AnyObjectId objectId) {
|
||||||
return new CompressedBitmap(compressed, this);
|
return new CompressedBitmap(compressed, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompressedBitmap toBitmap(PackBitmapIndex i,
|
|
||||||
EWAHCompressedBitmap b) {
|
|
||||||
if (i != packIndex) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
if (b == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new CompressedBitmap(b, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompressedBitmapBuilder newBitmapBuilder() {
|
public CompressedBitmapBuilder newBitmapBuilder() {
|
||||||
return new CompressedBitmapBuilder(this);
|
return new CompressedBitmapBuilder(this);
|
||||||
|
@ -327,11 +316,18 @@ private EWAHCompressedBitmap ewahBitmap(Bitmap other) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final class CompressedBitmap implements Bitmap {
|
/**
|
||||||
|
* Wrapper for a {@link EWAHCompressedBitmap} and {@link PackBitmapIndex}.
|
||||||
|
* <p>
|
||||||
|
* For a EWAHCompressedBitmap {@code bitmap} representing a vector of
|
||||||
|
* bits, {@code new CompressedBitmap(bitmap, bitmapIndex)} represents the
|
||||||
|
* objects at those positions in {@code bitmapIndex.packIndex}.
|
||||||
|
*/
|
||||||
|
public static final class CompressedBitmap implements Bitmap {
|
||||||
final EWAHCompressedBitmap bitmap;
|
final EWAHCompressedBitmap bitmap;
|
||||||
final BitmapIndexImpl bitmapIndex;
|
final BitmapIndexImpl bitmapIndex;
|
||||||
|
|
||||||
CompressedBitmap(EWAHCompressedBitmap bitmap, BitmapIndexImpl bitmapIndex) {
|
public CompressedBitmap(EWAHCompressedBitmap bitmap, BitmapIndexImpl bitmapIndex) {
|
||||||
this.bitmap = bitmap;
|
this.bitmap = bitmap;
|
||||||
this.bitmapIndex = bitmapIndex;
|
this.bitmapIndex = bitmapIndex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
import org.eclipse.jgit.errors.MissingObjectException;
|
import org.eclipse.jgit.errors.MissingObjectException;
|
||||||
import org.eclipse.jgit.internal.JGitText;
|
import org.eclipse.jgit.internal.JGitText;
|
||||||
import org.eclipse.jgit.internal.storage.file.BitmapIndexImpl;
|
import org.eclipse.jgit.internal.storage.file.BitmapIndexImpl;
|
||||||
|
import org.eclipse.jgit.internal.storage.file.BitmapIndexImpl.CompressedBitmap;
|
||||||
import org.eclipse.jgit.internal.storage.file.PackBitmapIndex;
|
import org.eclipse.jgit.internal.storage.file.PackBitmapIndex;
|
||||||
import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder;
|
import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder;
|
||||||
import org.eclipse.jgit.internal.storage.file.PackBitmapIndexRemapper;
|
import org.eclipse.jgit.internal.storage.file.PackBitmapIndexRemapper;
|
||||||
|
@ -390,7 +391,7 @@ private CommitSelectionHelper setupTipCommitBitmaps(RevWalk rw,
|
||||||
if (!reuse.contains(rc)) {
|
if (!reuse.contains(rc)) {
|
||||||
EWAHCompressedBitmap bitmap = bitmapRemapper.ofObjectType(
|
EWAHCompressedBitmap bitmap = bitmapRemapper.ofObjectType(
|
||||||
bitmapRemapper.getBitmap(rc), Constants.OBJ_COMMIT);
|
bitmapRemapper.getBitmap(rc), Constants.OBJ_COMMIT);
|
||||||
reuse.or(commitBitmapIndex.toBitmap(writeBitmaps, bitmap));
|
reuse.or(new CompressedBitmap(bitmap, commitBitmapIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue