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;
import net.pterodactylus.sone.database.PostBuilder;
import net.pterodactylus.sone.database.PostReplyBuilder;
import net.pterodactylus.sone.freenet.wot.Identity;
-import net.pterodactylus.sone.freenet.wot.OwnIdentity;
import net.pterodactylus.sone.template.SoneAccessor;
+import freenet.keys.FreenetURI;
+
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.primitives.Ints;
-import freenet.keys.FreenetURI;
/**
* A Sone defines everything about a user: her profile, her status updates, her
@Override
public boolean apply(Sone sone) {
- return (sone == null) ? false : sone.getIdentity() instanceof OwnIdentity;
+ return (sone == null) ? false : sone.isLocal();
}
};
}
};
+ public static final Function<Sone, List<Post>> TO_POSTS = new Function<Sone, List<Post>>() {
+ @Override
+ public List<Post> apply(Sone sone) {
+ return (sone == null) ? Collections.<Post>emptyList() : sone.getPosts();
+ }
+ };
+
/**
* Returns the identity of this Sone.
*
Client getClient();
/**
- * Sets the client used by this Sone.
- *
- * @param client
- * The client used by this Sone, or {@code null}
- * @return This Sone (for method chaining)
- */
- Sone setClient(Client client);
-
- /**
* Returns whether this Sone is known.
*
* @return {@code true} if this Sone is known, {@code false} otherwise
*
* @return The friend Sones of this Sone
*/
- List<String> getFriends();
+ Collection<String> getFriends();
/**
* Returns whether this Sone has the given Sone as a friend Sone.
Sone setLikePostIds(Set<String> likedPostIds);
/**
- * Checks whether the given post ID is liked by this Sone.
- *
- * @param postId
- * The ID of the post
- * @return {@code true} if this Sone likes the given post, {@code false}
- * otherwise
- */
- boolean isLikedPostId(String postId);
-
- /**
- * Adds the given post ID to the list of posts this Sone likes.
- *
- * @param postId
- * The ID of the post
- * @return This Sone (for method chaining)
- */
- Sone addLikedPostId(String postId);
-
- /**
- * Removes the given post ID from the list of posts this Sone likes.
- *
- * @param postId
- * The ID of the post
- * @return This Sone (for method chaining)
- */
- Sone removeLikedPostId(String postId);
-
- /**
* Returns the IDs of all liked replies.
*
* @return All liked replies’ IDs