*/
public class Reply {
+ /** The Sone that posted this reply. */
+ private final Sone sone;
+
/** The ID of the reply. */
private final UUID id;
/**
* Creates a new reply.
*
+ * @param sone
+ * The sone that posted the reply
* @param post
* The post to reply to
* @param text
* The text of the reply
*/
- public Reply(Post post, String text) {
- this(post, System.currentTimeMillis(), text);
+ public Reply(Sone sone, Post post, String text) {
+ this(sone, post, System.currentTimeMillis(), text);
}
/**
* Creates a new reply-
*
+ * @param sone
+ * The sone that posted the reply
* @param post
* The post to reply to
* @param time
* @param text
* The text of the reply
*/
- public Reply(Post post, long time, String text) {
- this(UUID.randomUUID(), post, time, text);
+ public Reply(Sone sone, Post post, long time, String text) {
+ this(sone, UUID.randomUUID(), post, time, text);
}
/**
* Creates a new reply-
*
+ * @param sone
+ * The sone that posted the reply
* @param id
* The ID of the reply
* @param post
* @param text
* The text of the reply
*/
- public Reply(UUID id, Post post, long time, String text) {
+ public Reply(Sone sone, UUID id, Post post, long time, String text) {
+ this.sone = sone;
this.id = id;
this.post = post;
this.time = time;
//
/**
+ * Returns the Sone that posted this reply.
+ *
+ * @return The Sone that posted this reply
+ */
+ public Sone getSone() {
+ return sone;
+ }
+
+ /**
* Returns the ID of the reply.
*
* @return The ID of the reply
*/
@Override
public int hashCode() {
- return post.hashCode() ^ id.hashCode();
+ return sone.hashCode() ^ id.hashCode() ^ post.hashCode() ^ (int) (time >> 32) ^ (int) (time & 0xffffffff);
}
/**
if (!(object instanceof Reply)) {
return false;
}
- return ((Reply) object).post.equals(post) && ((Reply) object).id.equals(id);
+ Reply reply = (Reply) object;
+ return reply.sone.equals(sone) && reply.id.equals(id) && reply.post.equals(post) && (reply.time == time) && reply.text.equals(text);
}
}