Add filter for local Sones.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 8 Jun 2011 11:23:07 +0000 (13:23 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 8 Jun 2011 11:23:07 +0000 (13:23 +0200)
src/main/java/net/pterodactylus/sone/data/Sone.java

index 715d95b..e1c0391 100644 (file)
@@ -27,8 +27,10 @@ import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import net.pterodactylus.sone.core.Core;
 import net.pterodactylus.sone.core.Options;
 import net.pterodactylus.sone.freenet.wot.Identity;
+import net.pterodactylus.sone.freenet.wot.OwnIdentity;
 import net.pterodactylus.sone.template.SoneAccessor;
 import net.pterodactylus.util.filter.Filter;
 import net.pterodactylus.util.logging.Logging;
@@ -67,6 +69,16 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
                }
        };
 
+       /** Filter that matches all {@link Core#isLocalSone(Sone) local Sones}. */
+       public static final Filter<Sone> LOCAL_SONE_FILTER = new Filter<Sone>() {
+
+               @Override
+               public boolean filterObject(Sone sone) {
+                       return sone.getIdentity() instanceof OwnIdentity;
+               }
+
+       };
+
        /** The logger. */
        private static final Logger logger = Logging.getLogger(Sone.class);