From d77adc6776035bac8cc455c8a9b352195c672aa4 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 28 Oct 2011 08:08:01 +0000 Subject: [PATCH] * commit renamed file --- ...stUtilities.java => EpisodeUtilities.java} | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) rename source/net/sourceforge/filebot/web/{EpisodeListUtilities.java => EpisodeUtilities.java} (87%) diff --git a/source/net/sourceforge/filebot/web/EpisodeListUtilities.java b/source/net/sourceforge/filebot/web/EpisodeUtilities.java similarity index 87% rename from source/net/sourceforge/filebot/web/EpisodeListUtilities.java rename to source/net/sourceforge/filebot/web/EpisodeUtilities.java index 9970024c..b8392a21 100644 --- a/source/net/sourceforge/filebot/web/EpisodeListUtilities.java +++ b/source/net/sourceforge/filebot/web/EpisodeUtilities.java @@ -8,10 +8,15 @@ import java.util.Comparator; import java.util.List; -final class EpisodeListUtilities { +public final class EpisodeUtilities { + public static String removeTrailingBraces(String name) { + // remove trailing braces, e.g. Doctor Who (2005) -> Doctor Who + return name.replaceAll("[(]([^)]*)[)]", "").trim(); + } + + public static List filterBySeason(Iterable episodes, int season) { - List results = new ArrayList(25); // filter given season from all seasons @@ -25,11 +30,6 @@ final class EpisodeListUtilities { } - public static void sortEpisodes(List episodes) { - Collections.sort(episodes, episodeComparator()); - } - - public static int getLastSeason(Iterable episodes) { int lastSeason = 0; @@ -44,6 +44,11 @@ final class EpisodeListUtilities { } + public static void sortEpisodes(List episodes) { + Collections.sort(episodes, episodeComparator()); + } + + public static Comparator episodeComparator() { return new Comparator() { @@ -79,7 +84,7 @@ final class EpisodeListUtilities { } - private EpisodeListUtilities() { + private EpisodeUtilities() { throw new UnsupportedOperationException(); } }