File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/midx Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ public interface MultiPackIndex {
4242 /**
4343 * Obtain the location of the object.
4444 * <p>
45- * The returned object can be reused by the implementations. Callers
46- * must create a #copy() if they want to keep a reference.
45+ * The returned object can be reused by the implementations. Callers must
46+ * create a #copy() if they want to keep a reference.
4747 *
4848 * @param objectId
4949 * objectId to read.
@@ -74,12 +74,30 @@ public interface MultiPackIndex {
7474
7575 /**
7676 * (packId, offset) coordinates of an object
77+ * <p>
78+ * Mutable object to avoid creating many instances while looking for objects
79+ * in the pack. Use #copy() to get a new instance with the data.
7780 */
7881 class PackOffset {
7982
80- int packId ;
81-
82- long offset ;
83+ private int packId ;
84+
85+ private long offset ;
86+
87+ /**
88+ * Return a new PackOffset with the defined data.
89+ * <p>
90+ * This is for tests, as regular code reuses the instance
91+ *
92+ * @param packId
93+ * a pack id
94+ * @param offset
95+ * an offset
96+ * @return a new PackOffset instance with this data
97+ */
98+ public static PackOffset create (int packId , long offset ) {
99+ return new PackOffset ().setValues (packId , offset );
100+ }
83101
84102 protected PackOffset setValues (int packId , long offset ) {
85103 this .packId = packId ;
You can’t perform that action at this time.
0 commit comments