|
@@ -26,7 +26,7 @@ public class JPlagResult {
|
|
|
private final int SIMILARITY_DISTRIBUTION_SIZE = 10;
|
|
private final int SIMILARITY_DISTRIBUTION_SIZE = 10;
|
|
|
|
|
|
|
|
public JPlagResult(List<JPlagComparison> comparisons, SubmissionSet submissions, long durationInMillis, JPlagOptions options) {
|
|
public JPlagResult(List<JPlagComparison> comparisons, SubmissionSet submissions, long durationInMillis, JPlagOptions options) {
|
|
|
- // sort comparisons by percentage (descending)
|
|
|
|
|
|
|
+ // sort by similarity (descending)
|
|
|
this.comparisons = comparisons.stream().sorted((first, second) -> Double.compare(second.similarity(), first.similarity())).toList();
|
|
this.comparisons = comparisons.stream().sorted((first, second) -> Double.compare(second.similarity(), first.similarity())).toList();
|
|
|
this.submissions = submissions;
|
|
this.submissions = submissions;
|
|
|
this.durationInMillis = durationInMillis;
|
|
this.durationInMillis = durationInMillis;
|
|
@@ -36,7 +36,7 @@ public class JPlagResult {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Drops elements from the comparison list to free memory. Note, that this affects the similarity distribution and is
|
|
* Drops elements from the comparison list to free memory. Note, that this affects the similarity distribution and is
|
|
|
- * only meant to be used if you don't need the information about comparisons with lower match percentage anymore.
|
|
|
|
|
|
|
+ * only meant to be used if you don't need the information about comparisons with lower match similarity anymore.
|
|
|
* @param limit the number of comparisons to keep in the list
|
|
* @param limit the number of comparisons to keep in the list
|
|
|
*/
|
|
*/
|
|
|
public void dropComparisons(int limit) {
|
|
public void dropComparisons(int limit) {
|
|
@@ -48,17 +48,17 @@ public class JPlagResult {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @return a list of all comparisons sorted by percentage (descending)
|
|
|
|
|
|
|
+ * @return a list of all comparisons sorted by similarity (descending)
|
|
|
*/
|
|
*/
|
|
|
public List<JPlagComparison> getAllComparisons() {
|
|
public List<JPlagComparison> getAllComparisons() {
|
|
|
return comparisons;
|
|
return comparisons;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Returns the first n comparisons (sorted by percentage, descending), limited by the specified parameter.
|
|
|
|
|
|
|
+ * Returns the first n comparisons (sorted by similarity, descending), limited by the specified parameter.
|
|
|
* @param numberOfComparisons specifies the number of requested comparisons. If set to -1, all comparisons will be
|
|
* @param numberOfComparisons specifies the number of requested comparisons. If set to -1, all comparisons will be
|
|
|
* returned.
|
|
* returned.
|
|
|
- * @return a list of comparisons sorted descending by percentage.
|
|
|
|
|
|
|
+ * @return a list of comparisons sorted descending by similarity.
|
|
|
*/
|
|
*/
|
|
|
public List<JPlagComparison> getComparisons(int numberOfComparisons) {
|
|
public List<JPlagComparison> getComparisons(int numberOfComparisons) {
|
|
|
if (numberOfComparisons == JPlagOptions.SHOW_ALL_COMPARISONS) {
|
|
if (numberOfComparisons == JPlagOptions.SHOW_ALL_COMPARISONS) {
|