import java.io.OutputStream;
import java.net.InetAddress;
+import java.util.Comparator;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
}
};
+ /** {@link Comparator} that sorts downloads by their name. */
+ public static final Comparator<Download> BY_NAME = new Comparator<Download>() {
+
+ @Override
+ public int compare(Download leftDownload, Download rightDownload) {
+ return leftDownload.pack().name().compareToIgnoreCase(rightDownload.pack().name());
+ }
+ };
+
+ /** {@link Comparator} that sorts running downloads first. */
+ public static final Comparator<Download> BY_RUNNING = new Comparator<Download>() {
+
+ @Override
+ public int compare(Download leftDownload, Download rightDownload) {
+ return (leftDownload.dccReceiver() != null) ? -1 : (rightDownload.dccReceiver() != null) ? 1 : 0;
+ }
+ };
+
/** The bot that is being downloaded from. */
private final Bot bot;