Store locality of a Sone in the Sone itself, remove related methods from Database.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index ac6e41a..d515424 100644 (file)
@@ -150,7 +150,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
                }
        };
 
-       /** Filter that matches all {@link Core#isLocalSone(Sone) local Sones}. */
+       /** Filter that matches all {@link Core#getLocalSones() local Sones}. */
        public static final Filter<Sone> LOCAL_SONE_FILTER = new Filter<Sone>() {
 
                @Override
@@ -175,6 +175,9 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
        /** The ID of this Sone. */
        private final String id;
 
+       /** Whether this is a local Sone. */
+       private final boolean local;
+
        /** The identity of this Sone. */
        private Identity identity;
 
@@ -229,9 +232,12 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
         *
         * @param id
         *            The ID of the Sone
+        * @param local
+        *            {@code true} if this Sone is local, {@code false} otherwise
         */
-       public Sone(String id) {
+       public Sone(String id, boolean local) {
                this.id = id;
+               this.local = local;
        }
 
        //
@@ -275,6 +281,15 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
        }
 
        /**
+        * Returns whether this Sone is local.
+        *
+        * @return {@code true} if this Sone is local, {@code false} otherwise
+        */
+       public boolean isLocal() {
+               return local;
+       }
+
+       /**
         * Returns the name of this Sone.
         *
         * @return The name of this Sone