1 package net.pterodactylus.rhynodge.filters.webpages.savoy;
3 import com.fasterxml.jackson.annotation.JsonProperty;
5 import java.util.ArrayList;
7 import java.util.Objects;
8 import java.util.stream.Collectors;
10 import static java.lang.String.format;
13 * Information about a movie.
15 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
20 private final String name;
23 private final String imageUrl;
26 private final List<Performance> performances = new ArrayList<>();
32 public Movie(String name, String imageUrl) {
34 this.imageUrl = imageUrl;
37 public String getName() {
41 public String getImageUrl() {
45 public List<Performance> getPerformances() {
49 public void addPerformance(Performance performance) {
50 performances.add(performance);
54 public String toString() {
55 return format("%s (%s, %s)", name, imageUrl, performances.stream().map(link -> String.format("%s: %s", link.getTime(), link.getLink())).collect(Collectors.joining(", ")));
59 public int hashCode() {
60 return Objects.hash(name, imageUrl, performances);
64 public boolean equals(Object o) {
65 if (this == o) return true;
66 if (o == null || getClass() != o.getClass()) return false;
67 Movie movie = (Movie) o;
68 return Objects.equals(name, movie.name) && Objects.equals(imageUrl, movie.imageUrl) && Objects.equals(performances, movie.performances);