]> source.dussan.org Git - jgit.git/commitdiff
BitmapWalkListener: Add method and rename for commits 35/205535/2
authorIvan Frade <ifrade@google.com>
Thu, 16 Nov 2023 18:46:07 +0000 (10:46 -0800)
committerIvan Frade <ifrade@google.com>
Thu, 16 Nov 2023 22:37:24 +0000 (14:37 -0800)
During the walk, the commit can be either
1. already in the walk bitmap
2. unvisited so far with bitmap in the bitmap index
3. unvisited so far without bitmap in the bitmap index

Expose these three states in the interface. This makes the interface
easier to explain: it reports the commits found during the walk.

As it is all about commits, rename the methods to onCommit***.

Change-Id: I661f303eb22d3e735b0e439f16df7ace612376d9

org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BitmapWalker.java

index 5060823571f2be0e18a5eef8f1e856044afde03f..2218462426f96d234bf031f0b2892664924d907a 100644 (file)
@@ -48,29 +48,39 @@ public final class BitmapWalker {
        private Bitmap prevBitmap;
 
        /**
-        * Report events happening during the walk.
+        * Report commits found during the walk
         *
         * @since 6.8
         */
        public interface BitmapWalkListener {
+               /**
+                * The commit is already in the walk bitmap
+                *
+                * @param oid
+                *            objectId of the commit already in bitmap
+                */
+               default void onCommitInBitmap(ObjectId oid) {
+                       // Nothing to do
+               }
 
                /**
-                * The object is in the walk, and it has a bitmap
+                * The commit has a bitmap in the bitmap index
                 *
                 * @param oid
-                *            objectId with a bitmap in the bitmap index
+                *            objectId of the commit with a bitmap in the bitmap index
                 */
-               default void onBitmapFound(ObjectId oid) {
+               default void onCommitWithBitmap(ObjectId oid) {
                        // Nothing to do
                }
 
                /**
-                * The object is in the walk but doesn't have bitmap
+                * The commit doesn't have bitmap
                 *
                 * @param oid
-                *            objectId without a bitmap in the bitmap index
+                *            objectId of the commit without a bitmap in the bitmap
+                *            index
                 */
-               default void onBitmapNotFound(ObjectId oid) {
+               default void onCommitWithoutBitmap(ObjectId oid) {
                        // Nothing to do
                }
        }
@@ -195,7 +205,7 @@ public final class BitmapWalker {
                        Bitmap bitmap = bitmapIndex.getBitmap(obj);
                        if (bitmap != null) {
                                result.or(bitmap);
-                               listener.onBitmapFound(obj);
+                               listener.onCommitWithBitmap(obj);
                        }
                }
 
@@ -236,7 +246,7 @@ public final class BitmapWalker {
                        Bitmap bitmap = bitmapIndex.getBitmap(obj);
                        if (bitmap != null) {
                                bitmapResult.or(bitmap);
-                               listener.onBitmapFound(obj);
+                               listener.onCommitWithBitmap(obj);
                        }
                }
 
@@ -279,7 +289,7 @@ public final class BitmapWalker {
                                // of bitmaps.
                                pm.update(1);
                                countOfBitmapIndexMisses++;
-                               listener.onBitmapNotFound(oid);
+                               listener.onCommitWithoutBitmap(oid);
                        }
 
                        RevObject ro;