2 * FreenetSone - StatusUpdate.java - Copyright © 2010 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sone.data;
20 import java.util.UUID;
23 * A post is a short message that a user writes in his Sone to let other users
24 * know what is going on.
26 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
30 /** The GUID of the post. */
31 private final UUID id;
33 /** The Sone this post belongs to. */
34 private final Sone sone;
36 /** The time of the post (in milliseconds since Jan 1, 1970 UTC). */
37 private final long time;
39 /** The text of the post. */
40 private final String text;
46 * The Sone this post belongs to
48 * The text of the post
50 public Post(Sone sone, String text) {
51 this(sone, System.currentTimeMillis(), text);
58 * The Sone this post belongs to
60 * The time of the post (in milliseconds since Jan 1, 1970 UTC)
62 * The text of the post
64 public Post(Sone sone, long time, String text) {
65 this(UUID.randomUUID(), sone, time, text);
74 * The Sone this post belongs to
76 * The time of the post (in milliseconds since Jan 1, 1970 UTC)
78 * The text of the post
80 public Post(UUID id, Sone sone, long time, String text) {
88 * Returns the ID of the post.
90 * @return The ID of the post
92 public String getId() {
97 * Returns the Sone this post belongs to.
99 * @return The Sone of this post
101 public Sone getSone() {
106 * Returns the time of the post.
108 * @return The time of the post (in milliseconds since Jan 1, 1970 UTC)
110 public long getTime() {
115 * Returns the text of the post.
117 * @return The text of the post
119 public String getText() {
131 public int hashCode() {
132 return text.hashCode() ^ (int) (time >> 32) ^ (int) (time & 0xffffffff);
139 public boolean equals(Object object) {
140 if (!(object instanceof Post)) {
143 return ((Post) object).id.equals(id);