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