File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
core/src/java/org/apache/lucene/util
misc/src/java/org/apache/lucene/misc/search Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1818
1919import java .util .Comparator ;
2020
21+ /** A specialization of {@link Comparator} that compares {@code float} values */
2122public interface FloatComparator {
23+
2224 interface ToFloatFunction <T > {
2325 float applyAsFloat (T obj );
2426 }
@@ -27,5 +29,10 @@ static <T> Comparator<T> comparing(ToFloatFunction<T> function) {
2729 return (a , b ) -> Float .compare (function .applyAsFloat (a ), function .applyAsFloat (b ));
2830 }
2931
32+ /**
33+ * Float-specialized {@link Comparator#compare}
34+ *
35+ * @see java.util.Comparator#compare
36+ */
3037 int compare (float f1 , float f2 );
3138}
Original file line number Diff line number Diff line change 6969public abstract class DiversifiedTopDocsCollector extends TopDocsCollector <ScoreDocKey > {
7070
7171 ScoreDocKey spare ;
72- private PriorityQueue <ScoreDocKey > globalQueue ;
73- private int numHits ;
74- private LongObjectHashMap <PriorityQueue <ScoreDocKey >> perKeyQueues ;
72+ private final PriorityQueue <ScoreDocKey > globalQueue ;
73+ private final int numHits ;
74+ private final LongObjectHashMap <PriorityQueue <ScoreDocKey >> perKeyQueues ;
7575 protected int maxNumPerKey ;
76- private Deque <PriorityQueue <ScoreDocKey >> sparePerKeyQueues = new ArrayDeque <>();
76+ private final Deque <PriorityQueue <ScoreDocKey >> sparePerKeyQueues = new ArrayDeque <>();
7777
7878 public DiversifiedTopDocsCollector (int numHits , int maxHitsPerKey ) {
7979 super (createScoreDocQueue (numHits ));
80- // Need to access pq.lessThan() which is protected so have to cast here...
8180 this .globalQueue = pq ;
82- perKeyQueues = new LongObjectHashMap <>();
81+ this . perKeyQueues = new LongObjectHashMap <>();
8382 this .numHits = numHits ;
8483 this .maxNumPerKey = maxHitsPerKey ;
8584 }
You can’t perform that action at this time.
0 commit comments