-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sort feeds on the no reference list and limit them to 25 maximum items
- Loading branch information
1 parent
b10320d
commit 97678ee
Showing
5 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...litydata/gtfsvalidator/outputcomparator/io/LatestReportUsedMemoryIncreasedComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.mobilitydata.gtfsvalidator.outputcomparator.io; | ||
|
||
import java.util.Comparator; | ||
import org.mobilitydata.gtfsvalidator.performance.MemoryUsage; | ||
|
||
/** | ||
* Comparator to compare two {@link DatasetMemoryUsage} objects based on the difference between the | ||
* used memory of the two objects based on the {@link DatasetMemoryUsage#getLatestMemoryUsage}. | ||
*/ | ||
public class LatestReportUsedMemoryIncreasedComparator implements Comparator<DatasetMemoryUsage> { | ||
|
||
@Override | ||
public int compare(DatasetMemoryUsage o1, DatasetMemoryUsage o2) { | ||
if (o1 == o2) { | ||
return 0; | ||
} | ||
if (o1 == null || o2 == null) { | ||
return o1 == null ? -1 : 1; | ||
} | ||
if (o1.getLatestMemoryUsage() == null && o2.getLatestMemoryUsage() == null) { | ||
return 0; | ||
} | ||
if (o1.getLatestMemoryUsage() == null || o2.getLatestMemoryUsage() == null) { | ||
return o1.getLatestMemoryUsage() == null ? -1 : 1; | ||
} | ||
long o1MinDiff = | ||
o1.getLatestMemoryUsage().stream() | ||
.min(Comparator.comparingLong(MemoryUsage::usedMemory)) | ||
.get() | ||
.usedMemory(); | ||
long o2MinDiff = | ||
o2.getLatestMemoryUsage().stream() | ||
.min(Comparator.comparingLong(MemoryUsage::usedMemory)) | ||
.get() | ||
.usedMemory(); | ||
return Long.compare(o1MinDiff, o2MinDiff); | ||
} | ||
|
||
@Override | ||
public Comparator<DatasetMemoryUsage> reversed() { | ||
return Comparator.super.reversed(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters