Store posts in a set, not in a list!
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index 9219e99..a387545 100644 (file)
@@ -57,6 +57,9 @@ public class Sone {
        /* This will be null for remote Sones! */
        private FreenetURI insertUri;
 
+       /** The time of the last inserted update. */
+       private long time;
+
        /** The profile of this Sone. */
        private Profile profile;
 
@@ -64,7 +67,7 @@ public class Sone {
        private final Set<Sone> friendSones = new HashSet<Sone>();
 
        /** All posts. */
-       private final List<Post> posts = new ArrayList<Post>();
+       private final Set<Post> posts = new HashSet<Post>();
 
        /** All replies. */
        private final Set<Reply> replies = new HashSet<Reply>();
@@ -159,6 +162,27 @@ public class Sone {
        }
 
        /**
+        * Return the time of the last inserted update of this Sone.
+        *
+        * @return The time of the update (in milliseconds since Jan 1, 1970 UTC)
+        */
+       public long getTime() {
+               return time;
+       }
+
+       /**
+        * Sets the time of the last inserted update of this Sone.
+        *
+        * @param time
+        *            The time of the update (in milliseconds since Jan 1, 1970 UTC)
+        * @return This Sone (for method chaining)
+        */
+       public Sone setTime(long time) {
+               this.time = time;
+               return this;
+       }
+
+       /**
         * Returns a copy of the profile. If you want to update values in the
         * profile of this Sone, update the values in the returned {@link Profile}
         * and use {@link #setProfile(Profile)} to change the profile in this Sone.