package net.pterodactylus.sone.data;
+import java.util.Comparator;
import java.util.UUID;
/**
*/
public class Reply {
+ /** Comparator that sorts replies ascending by time. */
+ public static final Comparator<Reply> TIME_COMPARATOR = new Comparator<Reply>() {
+
+ @Override
+ public int compare(Reply leftReply, Reply rightReply) {
+ return (int) Math.max(Integer.MIN_VALUE, Math.min(Integer.MAX_VALUE, leftReply.getTime() - rightReply.getTime()));
+ }
+
+ };
+
/** The ID of the reply. */
private final UUID id;
/** The Sone that posted this reply. */
- private Sone sone;
+ private volatile Sone sone;
/** The Post this reply refers to. */
- private Post post;
+ private volatile Post post;
/** The time of the reply. */
- private long time;
+ private volatile long time;
/** The text of the reply. */
- private String text;
+ private volatile String text;
/**
* Creates a new reply.