+public interface Post extends Identified {
+
+ /** Comparator for posts, sorts descending by time. */
+ public static final Comparator<Post> TIME_COMPARATOR = new Comparator<Post>() {
+
+ @Override
+ public int compare(Post leftPost, Post rightPost) {
+ return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, rightPost.getTime() - leftPost.getTime()));
+ }
+
+ };
+
+ /** Filter for posts with timestamps from the future. */
+ public static final Predicate<Post> FUTURE_POSTS_FILTER = new Predicate<Post>() {
+
+ @Override
+ public boolean apply(Post post) {
+ return (post == null) ? false : post.getTime() <= System.currentTimeMillis();
+ }
+
+ };
+
+ public static final Function<Post, List<PostReply>> TO_REPLIES = new Function<Post, List<PostReply>>() {
+ @Override
+ public List<PostReply> apply(Post post) {
+ return (post == null) ? Collections.<PostReply>emptyList() : post.getReplies();
+ }
+ };
+
+ //
+ // ACCESSORS
+ //
+
+ /**
+ * Returns the ID of the post.
+ *
+ * @return The ID of the post
+ */
+ public String getId();