Skip to content

Commit 3a849db

Browse files
committed
Javadocs
1 parent d8dd30f commit 3a849db

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lucene/core/src/java/org/apache/lucene/util/FloatComparator.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
import java.util.Comparator;
2020

21+
/** A specialization of {@link Comparator} that compares {@code float} values */
2122
public 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
}

lucene/misc/src/java/org/apache/lucene/misc/search/DiversifiedTopDocsCollector.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,16 @@
6969
public 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
}

0 commit comments

Comments
 (0)