Minor optimizations

This commit is contained in:
Reinhard Pointner 2016-10-08 23:56:29 +08:00
parent db85b77dad
commit 5ca51e1d7d
1 changed files with 37 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package net.filebot.web;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;
import java.util.Arrays;
import java.util.List;
@ -15,12 +16,10 @@ public class MultiEpisode extends Episode {
}
public MultiEpisode(Episode... episodes) {
super(episodes[0]);
this.episodes = episodes.clone();
}
public MultiEpisode(List<Episode> episodes) {
super(episodes.get(0));
this.episodes = episodes.toArray(new Episode[0]);
}
@ -28,6 +27,42 @@ public class MultiEpisode extends Episode {
return unmodifiableList(asList(episodes));
}
public String getSeriesName() {
return episodes[0].getSeriesName();
}
public Integer getEpisode() {
return episodes[0].getEpisode();
}
public Integer getSeason() {
return episodes[0].getSeason();
}
public String getTitle() {
return EpisodeFormat.SeasonEpisode.formatMultiTitle(getEpisodes());
}
public Integer getAbsolute() {
return episodes[0].getAbsolute();
}
public Integer getSpecial() {
return episodes[0].getSpecial();
}
public SimpleDate getAirdate() {
return episodes[0].getAirdate();
}
public SeriesInfo getSeriesInfo() {
return episodes[0].getSeriesInfo();
}
public List<Integer> getNumbers() {
return stream(episodes).flatMap(e -> e.getNumbers().stream()).collect(toList());
}
@Override
public boolean equals(Object obj) {
if (obj instanceof MultiEpisode) {