]> source.dussan.org Git - jgit.git/commit
PackIndex: Simplify Iterator/MutableEntry interaction 03/1200703/29
authorjackdt@google.com <jackdt@google.com>
Wed, 4 Sep 2024 23:07:23 +0000 (16:07 -0700)
committerIvan Frade <ifrade@google.com>
Fri, 13 Sep 2024 20:43:15 +0000 (20:43 +0000)
commit77e7479a36e5e9742043d0c54a02119a1097f623
tree4f39d528aff912f4db74a64a2e9385138ec6635f
parent17d3837e6c5b735b7aa3b8c0a80bb415f7c1e202
PackIndex: Simplify Iterator/MutableEntry interaction

The iterator keeps the current position in the index and the MutableEntry reads data from there on-demand, but the iterator needs to know about the entry and this creates a complicated interaction.

Make MutableEntry a simple data object and let the iterator iterate and populate it before returning it. Code is clearer and implementors only needs to worry about the iterator.

This fixes also MutableEntry visibility, that was preventing subclassing from out of the package.

Change-Id: I35010d1f80237e421dd51b8d3d61a8ecb03e0d01
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndex.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java