* easy to get episode key

This commit is contained in:
Reinhard Pointner 2014-01-04 19:31:38 +00:00
parent 29253af34d
commit 54854d3098
1 changed files with 32 additions and 48 deletions

View File

@ -1,10 +1,8 @@
package net.sourceforge.filebot.web; package net.sourceforge.filebot.web;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
public class Episode implements Serializable { public class Episode implements Serializable {
@ -27,22 +25,18 @@ public class Episode implements Serializable {
// original series descriptor // original series descriptor
private SearchResult series; private SearchResult series;
protected Episode() { protected Episode() {
// used by serializer // used by serializer
} }
public Episode(Episode obj) { public Episode(Episode obj) {
this(obj.seriesName, obj.seriesStartDate, obj.season, obj.episode, obj.title, obj.absolute, obj.special, obj.airdate, obj.series); this(obj.seriesName, obj.seriesStartDate, obj.season, obj.episode, obj.title, obj.absolute, obj.special, obj.airdate, obj.series);
} }
public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, SearchResult series) { public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, SearchResult series) {
this(seriesName, seriesStartDate, season, episode, title, null, null, null, series); this(seriesName, seriesStartDate, season, episode, title, null, null, null, series);
} }
public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, Integer absolute, Integer special, Date airdate, SearchResult series) { public Episode(String seriesName, Date seriesStartDate, Integer season, Integer episode, String title, Integer absolute, Integer special, Date airdate, SearchResult series) {
this.seriesName = seriesName; this.seriesName = seriesName;
this.seriesStartDate = seriesStartDate; this.seriesStartDate = seriesStartDate;
@ -55,51 +49,45 @@ public class Episode implements Serializable {
this.series = series; this.series = series;
} }
public String getSeriesName() { public String getSeriesName() {
return seriesName; return seriesName;
} }
public Date getSeriesStartDate() { public Date getSeriesStartDate() {
return seriesStartDate; return seriesStartDate;
} }
public Integer getEpisode() { public Integer getEpisode() {
return episode; return episode;
} }
public Integer getSeason() { public Integer getSeason() {
return season; return season;
} }
public String getTitle() { public String getTitle() {
return title; return title;
} }
public Integer getAbsolute() { public Integer getAbsolute() {
return absolute; return absolute;
} }
public Integer getSpecial() { public Integer getSpecial() {
return special; return special;
} }
public Date getAirdate() { public Date getAirdate() {
return airdate; return airdate;
} }
public SearchResult getSeries() { public SearchResult getSeries() {
return series; return series;
} }
public List<Integer> getNumbers() {
return Arrays.asList(season, episode, special);
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
@ -111,7 +99,6 @@ public class Episode implements Serializable {
return false; return false;
} }
private boolean equals(Object o1, Object o2) { private boolean equals(Object o1, Object o2) {
if (o1 == null || o2 == null) if (o1 == null || o2 == null)
return o1 == o2; return o1 == o2;
@ -119,19 +106,16 @@ public class Episode implements Serializable {
return o1.equals(o2); return o1.equals(o2);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Arrays.hashCode(new Object[] { seriesName, season, episode, title, special }); return Arrays.hashCode(new Object[] { seriesName, season, episode, title, special });
} }
@Override @Override
public Episode clone() { public Episode clone() {
return new Episode(this); return new Episode(this);
} }
@Override @Override
public String toString() { public String toString() {
return EpisodeFormat.SeasonEpisode.format(this); return EpisodeFormat.SeasonEpisode.format(this);