| 1 | |
|
| 2 | |
|
| 3 | |
package org.galagosearch.core.retrieval; |
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | 48 | public class ScoredDocument implements Comparable<ScoredDocument> { |
| 10 | 20 | public ScoredDocument(int document, double score) { |
| 11 | 20 | this.document = document; |
| 12 | 20 | this.score = score; |
| 13 | 20 | } |
| 14 | |
|
| 15 | |
public int compareTo(ScoredDocument other) { |
| 16 | 48 | if(score != other.score) |
| 17 | 44 | return Double.compare(score, other.score); |
| 18 | 4 | return other.document - document; |
| 19 | |
} |
| 20 | |
|
| 21 | |
public String toString() { |
| 22 | 0 | return String.format("%d,%f", document, score); |
| 23 | |
} |
| 24 | |
|
| 25 | |
public int document; |
| 26 | |
public double score; |
| 27 | |
} |
| 28 | |
|