X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSone.java;h=ca878564fa706665e031a0704a60cb7d768d7982;hp=e1c039174d464f0877b8109c7abaed4094ebd8eb;hb=192a3f41bcbf99fdb42213dc2680f9061ff64c40;hpb=20f2125c8a15ba58cbbf6410517d233934c1dc30 diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index e1c0391..ca87856 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -60,6 +60,17 @@ public class Sone implements Fingerprintable, Comparable { }; + /** + * Comparator that sorts Sones by last activity (least recent active first). + */ + public static final Comparator LAST_ACTIVITY_COMPARATOR = new Comparator() { + + @Override + public int compare(Sone firstSone, Sone secondSone) { + return (int) Math.min(Integer.MAX_VALUE, Math.max(Integer.MIN_VALUE, secondSone.getTime() - firstSone.getTime())); + } + }; + /** Filter to remove Sones that have not been downloaded. */ public static final Filter EMPTY_SONE_FILTER = new Filter() {