import net.pterodactylus.xdcc.data.Pack;
import com.google.common.base.Predicate;
+import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.eventbus.Subscribe;
@Override
public int compareTo(Result result) {
- if (isArchive.apply(this) && !isArchive.apply(result)) {
- return 1;
- }
- if (!isArchive.apply(this) && isArchive.apply(result)) {
- return -1;
- }
- /* sort by bot name. */
- return botNameComparator.compare(bot().name(), result.bot().name());
+ return ComparisonChain.start()
+ .compare(this, result, packArchiveComparator)
+ .compare(this, result, botNameComparator)
+ .compare(this, result, packNameComparator).result();
}
}