aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/BitmapIndex.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/BitmapIndex.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/BitmapIndex.java64
1 files changed, 62 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BitmapIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BitmapIndex.java
index b11b230a8f..acaa6335d4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BitmapIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BitmapIndex.java
@@ -40,6 +40,58 @@ public interface BitmapIndex {
BitmapBuilder newBitmapBuilder();
/**
+ * Report the results of {@link #getBitmap(AnyObjectId)}
+ *
+ * @since 6.8
+ */
+ interface BitmapLookupListener {
+
+ /**
+ * This object has a bitmap in the index
+ *
+ * @param oid
+ * object id
+ */
+ void onBitmapFound(AnyObjectId oid);
+
+ /**
+ * This object does not have a bitmap in the index
+ *
+ * @param oid
+ * object id
+ */
+ void onBitmapNotFound(AnyObjectId oid);
+
+ /**
+ * No-op instance
+ */
+ BitmapLookupListener NOOP = new BitmapLookupListener() {
+ @Override
+ public void onBitmapFound(AnyObjectId oid) {
+ // Nothing to do
+ }
+
+ @Override
+ public void onBitmapNotFound(AnyObjectId oid) {
+ // Nothing to do
+ }
+ };
+ }
+
+ /**
+ * Report to this listener whether {@link #getBitmap(AnyObjectId)} finds a
+ * commit.
+ *
+ * @param listener
+ * instance listening to lookup events in the index. Never null.
+ * Set to {@link BitmapLookupListener#NOOP} to disable.
+ * @since 6.8
+ */
+ default void addBitmapLookupListener(BitmapLookupListener listener) {
+ // Empty implementation for API compatibility
+ }
+
+ /**
* A bitmap representation of ObjectIds that can be iterated to return the
* underlying {@code ObjectId}s or operated on with other {@code Bitmap}s.
*/
@@ -159,7 +211,11 @@ public interface BitmapIndex {
@Override
BitmapBuilder xor(Bitmap other);
- /** @return the fully built immutable bitmap */
+ /**
+ * Build the bitmap
+ *
+ * @return the fully built immutable bitmap
+ */
Bitmap build();
/**
@@ -174,7 +230,11 @@ public interface BitmapIndex {
*/
boolean removeAllOrNone(PackBitmapIndex bitmapIndex);
- /** @return the number of elements in the bitmap. */
+ /**
+ * Get number of elements in the bitmap
+ *
+ * @return the number of elements in the bitmap.
+ */
int cardinality();
/**