projects
/
xudocci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Compare results, not the bot names.
[xudocci.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
xdcc
/
ui
/
stdin
/
CommandReader.java
diff --git
a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java
b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java
index
abef80e
..
d3821aa
100644
(file)
--- a/
src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java
+++ b/
src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java
@@
-351,7
+351,7
@@
public class CommandReader extends AbstractExecutionThreadService {
* one name pattern is preferred (and thus listed first), one pattern is
* disliked (and thus listed last), the rest is sorted alphabetically.
*/
* one name pattern is preferred (and thus listed first), one pattern is
* disliked (and thus listed last), the rest is sorted alphabetically.
*/
- private static final Comparator<
String> botNameComparator = new Comparator<String
>() {
+ private static final Comparator<
Result> botNameComparator = new Comparator<Result
>() {
/** Regular expression pattern for preferred names. */
private final Pattern preferredNames = Pattern.compile("(?i)[^\\w]EUR?[^\\w]");
/** Regular expression pattern for preferred names. */
private final Pattern preferredNames = Pattern.compile("(?i)[^\\w]EUR?[^\\w]");
@@
-360,7
+360,9
@@
public class CommandReader extends AbstractExecutionThreadService {
private final Pattern dislikedNames = Pattern.compile("(?i)[^\\w]USA?[^\\w]");
@Override
private final Pattern dislikedNames = Pattern.compile("(?i)[^\\w]USA?[^\\w]");
@Override
- public int compare(String leftBotName, String rightBotName) {
+ public int compare(Result leftResult, Result rightResult) {
+ String leftBotName = leftResult.bot().name();
+ String rightBotName = rightResult.bot().name();
/* preferred names to the front! */
if (preferredNames.matcher(leftBotName).find() && !preferredNames.matcher(rightBotName).find()) {
return -1;
/* preferred names to the front! */
if (preferredNames.matcher(leftBotName).find() && !preferredNames.matcher(rightBotName).find()) {
return -1;
@@
-375,8
+377,7
@@
public class CommandReader extends AbstractExecutionThreadService {
if (dislikedNames.matcher(rightBotName).find() && !dislikedNames.matcher(leftBotName).find()) {
return -1;
}
if (dislikedNames.matcher(rightBotName).find() && !dislikedNames.matcher(leftBotName).find()) {
return -1;
}
- /* rest is sorted by name. */
- return leftBotName.compareToIgnoreCase(rightBotName);
+ return 0;
}
};
}
};