+public abstract class Reply<T extends Reply<T>> {
+
+ /** Comparator that sorts replies ascending by time. */
+ public static final Comparator<Reply<?>> TIME_COMPARATOR = new Comparator<Reply<?>>() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int compare(Reply<?> leftReply, Reply<?> rightReply) {
+ return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, leftReply.getTime() - rightReply.getTime()));
+ }
+
+ };
+
+ /** Filter for replies with timestamps from the future. */
+ public static final Filter<Reply<?>> FUTURE_REPLY_FILTER = new Filter<Reply<?>>() {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean filterObject(Reply<?> reply) {
+ return reply.getTime() <= System.currentTimeMillis();
+ }