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 String description;
29 private final List<Performance> performances = new ArrayList<>();
35 public Movie(String name, String imageUrl) {
36 this(name, imageUrl, "");
39 public Movie(String name, String imageUrl, String description) {
41 this.imageUrl = imageUrl;
42 this.description = description;
45 public String getName() {
49 public String getImageUrl() {
53 public String getDescription() {
57 public List<Performance> getPerformances() {
61 public void addPerformance(Performance performance) {
62 performances.add(performance);
66 public String toString() {
67 return format("%s (%s, %s, %s)", name, imageUrl, description, performances.stream().map(link -> String.format("%s: %s", link.getTime(), link.getLink())).collect(Collectors.joining(", ")));
71 public int hashCode() {
72 return Objects.hash(name, imageUrl, description, performances);
76 public boolean equals(Object o) {
77 if (this == o) return true;
78 if (o == null || getClass() != o.getClass()) return false;
79 Movie movie = (Movie) o;
80 return Objects.equals(name, movie.name) && Objects.equals(imageUrl, movie.imageUrl) && Objects.equals(description, movie.description) && Objects.equals(performances, movie.performances);