From 82fab5b2d5883c62cda5438c13d6729982f2eb14 Mon Sep 17 00:00:00 2001 From: rmichela Date: Fri, 16 Mar 2012 03:41:41 -0400 Subject: [PATCH] [Bleeding] Moved HelpTopicComparator to Bukkit.jar. Addresses BUKKIT-1193 --- .../craftbukkit/help/HelpTopicComparator.java | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/main/java/org/bukkit/craftbukkit/help/HelpTopicComparator.java diff --git a/src/main/java/org/bukkit/craftbukkit/help/HelpTopicComparator.java b/src/main/java/org/bukkit/craftbukkit/help/HelpTopicComparator.java deleted file mode 100644 index c88bfafbfa..0000000000 --- a/src/main/java/org/bukkit/craftbukkit/help/HelpTopicComparator.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.bukkit.craftbukkit.help; - -import org.bukkit.help.HelpTopic; - -import java.util.Comparator; - -/** - * Used to impose a custom total ordering on help topics. All topics are listed in alphabetic order, but topics - * that start with a slash come after topics that don't. - */ -public class HelpTopicComparator implements Comparator { - - // Singleton implementations - private static final TopicNameComparator tnc = new TopicNameComparator(); - public static TopicNameComparator topicNameComparatorInstance() { - return tnc; - } - - private static final HelpTopicComparator htc = new HelpTopicComparator(); - public static HelpTopicComparator helpTopicComparatorInstance() { - return htc; - } - - private HelpTopicComparator() {} - - public int compare(HelpTopic lhs, HelpTopic rhs) { - return tnc.compare(lhs.getName(), rhs.getName()); - } - - public static class TopicNameComparator implements Comparator { - private TopicNameComparator(){} - - public int compare(String lhs, String rhs) { - boolean lhsStartSlash = lhs.startsWith("/"); - boolean rhsStartSlash = rhs.startsWith("/"); - - if (lhsStartSlash && !rhsStartSlash) { - return 1; - } else if (!lhsStartSlash && rhsStartSlash) { - return -1; - } else { - return lhs.compareToIgnoreCase(rhs); - } - } - } -}