From 5ca51e1d7d1dc5a8d49d1dc919d8e5d1cd6f4d0c Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 8 Oct 2016 23:56:29 +0800 Subject: [PATCH] Minor optimizations --- source/net/filebot/web/MultiEpisode.java | 39 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/source/net/filebot/web/MultiEpisode.java b/source/net/filebot/web/MultiEpisode.java index a1ba8e65..dc2cb6ca 100644 --- a/source/net/filebot/web/MultiEpisode.java +++ b/source/net/filebot/web/MultiEpisode.java @@ -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 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 getNumbers() { + return stream(episodes).flatMap(e -> e.getNumbers().stream()).collect(toList()); + } + @Override public boolean equals(Object obj) { if (obj instanceof MultiEpisode) {