* commit renamed file

This commit is contained in:
Reinhard Pointner 2011-10-28 08:08:01 +00:00
parent 1f0d9214fb
commit d77adc6776
1 changed files with 13 additions and 8 deletions

View File

@ -8,10 +8,15 @@ import java.util.Comparator;
import java.util.List; 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<Episode> filterBySeason(Iterable<Episode> episodes, int season) { public static List<Episode> filterBySeason(Iterable<Episode> episodes, int season) {
List<Episode> results = new ArrayList<Episode>(25); List<Episode> results = new ArrayList<Episode>(25);
// filter given season from all seasons // filter given season from all seasons
@ -25,11 +30,6 @@ final class EpisodeListUtilities {
} }
public static void sortEpisodes(List<Episode> episodes) {
Collections.sort(episodes, episodeComparator());
}
public static int getLastSeason(Iterable<Episode> episodes) { public static int getLastSeason(Iterable<Episode> episodes) {
int lastSeason = 0; int lastSeason = 0;
@ -44,6 +44,11 @@ final class EpisodeListUtilities {
} }
public static void sortEpisodes(List<Episode> episodes) {
Collections.sort(episodes, episodeComparator());
}
public static Comparator<Episode> episodeComparator() { public static Comparator<Episode> episodeComparator() {
return new Comparator<Episode>() { return new Comparator<Episode>() {
@ -79,7 +84,7 @@ final class EpisodeListUtilities {
} }
private EpisodeListUtilities() { private EpisodeUtilities() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }