Filter posts and replies from the future.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Reply.java
index a106391..2dacfbe 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 reply is like a {@link Post} but can never be posted on its own, it always
  * refers to another {@link Post}.
@@ -38,6 +40,16 @@ public class Reply {
 
        };
 
+       /** Filter for replies with timestamps from the future. */
+       public static final Filter<Reply> FUTURE_REPLIES_FILTER = new Filter<Reply>() {
+
+               @Override
+               public boolean filterObject(Reply reply) {
+                       return reply.getTime() <= System.currentTimeMillis();
+               }
+
+       };
+
        /** The ID of the reply. */
        private final UUID id;