Filter posts and replies from the future.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Post.java
index 964a054..bb431d0 100644 (file)
@@ -20,6 +20,8 @@ package net.pterodactylus.sone.data;
 import java.util.Comparator;
 import java.util.UUID;
 
+import net.pterodactylus.util.filter.Filter;
+
 /**
  * A post is a short message that a user writes in his Sone to let other users
  * know what is going on.
@@ -38,6 +40,16 @@ public class Post {
 
        };
 
+       /** Filter for posts with timestamps from the future. */
+       public static final Filter<Post> FUTURE_POSTS_FILTER = new Filter<Post>() {
+
+               @Override
+               public boolean filterObject(Post post) {
+                       return post.getTime() <= System.currentTimeMillis();
+               }
+
+       };
+
        /** The GUID of the post. */
        private final UUID id;