Add filter that removes not-downloaded Sones.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 30 Mar 2011 05:29:01 +0000 (07:29 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 30 Mar 2011 05:29:01 +0000 (07:29 +0200)
src/main/java/net/pterodactylus/sone/data/Sone.java

index cc54697..a1aa6ee 100644 (file)
@@ -29,6 +29,7 @@ import java.util.logging.Logger;
 
 import net.pterodactylus.sone.freenet.wot.Identity;
 import net.pterodactylus.sone.template.SoneAccessor;
+import net.pterodactylus.util.filter.Filter;
 import net.pterodactylus.util.logging.Logging;
 import freenet.keys.FreenetURI;
 
@@ -56,6 +57,15 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
 
        };
 
+       /** Filter to remove Sones that have not been downloaded. */
+       public static final Filter<Sone> EMPTY_SONE_FILTER = new Filter<Sone>() {
+
+               @Override
+               public boolean filterObject(Sone sone) {
+                       return sone.getTime() != 0;
+               }
+       };
+
        /** The logger. */
        private static final Logger logger = Logging.getLogger(Sone.class);