X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSone.java;h=2b0a2eb4231f658d33e5e68043e10be88bac2cd2;hb=5c5bee980f9cab5792e34d1c9840f73b8b191830;hp=4dd9a8e60bc37643dad06648326db15fb5731172;hpb=9b0b5b760adf41d52603a4b65f3e5f3220da28eb;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index 4dd9a8e..2b0a2eb 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -17,14 +17,7 @@ package net.pterodactylus.sone.data; -import static com.google.common.collect.FluentIterable.from; -import static java.util.Arrays.asList; -import static net.pterodactylus.sone.data.Album.FLATTENER; -import static net.pterodactylus.sone.data.Album.IMAGES; - import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; import java.util.List; import java.util.Set; @@ -35,9 +28,6 @@ import net.pterodactylus.sone.freenet.wot.Identity; import freenet.keys.FreenetURI; -import com.google.common.base.Function; -import com.google.common.primitives.Ints; - /** * A Sone defines everything about a user: her profile, her status updates, her * replies, her likes and dislikes, etc. @@ -62,38 +52,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable { downloading, } - /** Comparator that sorts Sones by number of images (descending). */ - public static final Comparator IMAGE_COUNT_COMPARATOR = new Comparator() { - - /** - * {@inheritDoc} - */ - @Override - public int compare(Sone leftSone, Sone rightSone) { - int rightSoneImageCount = from(asList(rightSone.getRootAlbum())).transformAndConcat(FLATTENER).transformAndConcat(IMAGES).size(); - int leftSoneImageCount = from(asList(leftSone.getRootAlbum())).transformAndConcat(FLATTENER).transformAndConcat(IMAGES).size(); - /* sort descending. */ - return Ints.compare(rightSoneImageCount, leftSoneImageCount); - } - }; - - public static final Function> toAllAlbums = new Function>() { - @Override - public List apply(@Nullable Sone sone) { - return (sone == null) ? Collections.emptyList() : FLATTENER.apply( - sone.getRootAlbum()); - } - }; - - public static final Function> toAllImages = new Function>() { - @Override - public List apply(@Nullable Sone sone) { - return (sone == null) ? Collections.emptyList() : - from(FLATTENER.apply(sone.getRootAlbum())) - .transformAndConcat(IMAGES).toList(); - } - }; - /** * Returns the identity of this Sone. *