🔀 Merge branch 'release/v82'
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index fa6f980..2b0a2eb 100644 (file)
 
 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,50 +52,6 @@ public interface Sone extends Identified, Fingerprintable, Comparable<Sone> {
                downloading,
        }
 
-       /** Comparator that sorts Sones by numbers of posts (descending). */
-       public static final Comparator<Sone> POST_COUNT_COMPARATOR = new Comparator<Sone>() {
-
-               /**
-                * {@inheritDoc}
-                */
-               @Override
-               public int compare(Sone leftSone, Sone rightSone) {
-                       return (leftSone.getPosts().size() != rightSone.getPosts().size()) ? (rightSone.getPosts().size() - leftSone.getPosts().size()) : (rightSone.getReplies().size() - leftSone.getReplies().size());
-               }
-       };
-
-       /** Comparator that sorts Sones by number of images (descending). */
-       public static final Comparator<Sone> IMAGE_COUNT_COMPARATOR = new Comparator<Sone>() {
-
-               /**
-                * {@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<Sone, List<Album>> toAllAlbums = new Function<Sone, List<Album>>() {
-               @Override
-               public List<Album> apply(@Nullable Sone sone) {
-                       return (sone == null) ? Collections.<Album>emptyList() : FLATTENER.apply(
-                                       sone.getRootAlbum());
-               }
-       };
-
-       public static final Function<Sone, List<Image>> toAllImages = new Function<Sone, List<Image>>() {
-               @Override
-               public List<Image> apply(@Nullable Sone sone) {
-                       return (sone == null) ? Collections.<Image>emptyList() :
-                                       from(FLATTENER.apply(sone.getRootAlbum()))
-                                                       .transformAndConcat(IMAGES).toList();
-               }
-       };
-
        /**
         * Returns the identity of this Sone.
         *