Add predicate that identifies running downloads.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 18 Apr 2013 04:10:59 +0000 (06:10 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 18 Apr 2013 04:10:59 +0000 (06:10 +0200)
src/main/java/net/pterodactylus/xdcc/data/Download.java

index 0592eaf..926adad 100644 (file)
@@ -24,6 +24,8 @@ import java.net.InetAddress;
 
 import net.pterodactylus.irc.DccReceiver;
 
+import com.google.common.base.Predicate;
+
 /**
  * Information about an ongoing download.
  *
@@ -31,6 +33,15 @@ import net.pterodactylus.irc.DccReceiver;
  */
 public class Download {
 
+       /** Predicate that identifies downloads that have started. */
+       public static final Predicate<Download> FILTER_RUNNING = new Predicate<Download>() {
+
+               @Override
+               public boolean apply(Download download) {
+                       return download.dccReceiver() != null;
+               }
+       };
+
        /** The bot that is being downloaded from. */
        private final Bot bot;