diff options
Diffstat (limited to '')
-rw-r--r-- | src/de/animux/android/andmal/api/anime/Anime.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/de/animux/android/andmal/api/anime/Anime.java b/src/de/animux/android/andmal/api/anime/Anime.java index d4f542f..dc4b34e 100644 --- a/src/de/animux/android/andmal/api/anime/Anime.java +++ b/src/de/animux/android/andmal/api/anime/Anime.java @@ -1,6 +1,8 @@ package de.animux.android.andmal.api.anime; -public class Anime implements Comparable<Anime> { +import de.animux.android.andmal.api.MalObject; + +public class Anime extends MalObject { private int id; private String title; @@ -180,18 +182,28 @@ public class Anime implements Comparable<Anime> { } @Override - public int compareTo(Anime arg0) { - int compareTitle = arg0.getTitle().compareTo(getTitle()); + public int compareTo(MalObject arg0) { + if ( !(arg0 instanceof Anime)) { + throw new IllegalArgumentException(); + } + + Anime a = (Anime)arg0; + int compareTitle = a.getTitle().compareTo(getTitle()); if (compareTitle != 0) { return compareTitle; } else { - if (arg0.getId() != getId()) { - return getId() - arg0.getId(); + if (a.getId() != getId()) { + return getId() - a.getId(); } } return 0; } + @Override + public String getProgress() { + return getWatchedEpisodes() + "/" + getEpisodes(); + } + } |