]> source.dussan.org Git - jgit.git/commit
Use Comparators for PackSource 96/123696/3
authorDave Borowitz <dborowitz@google.com>
Wed, 30 May 2018 19:02:35 +0000 (12:02 -0700)
committerDave Borowitz <dborowitz@google.com>
Fri, 1 Jun 2018 16:41:17 +0000 (12:41 -0400)
commite7bacf0a7f8d4e6faf63d87705da07a13389e41c
tree3999cc57849edb5b7430b51828b67940c06f4699
parent43ec590d0e7c6b294bcbb1f7e4c2490b6b984c20
Use Comparators for PackSource

Rather than requiring callers to do their own computations based on the
package-private "category" number, provide an actual
Comparator<PackSource> instance, and explicitly discourage usage of
default Enum comparison.

Construct the default comparator using a builder pattern based on
defining equivalence classes. This gives us the same behavior as the old
category field in PackSource, with an abstraction that does not leak the
implementation detail of comparing rank numbers.

Change-Id: I6757211397ab1bc181d61298e073f88b69dbefc3
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/PackSourceTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java