1 package net.pterodactylus.rhynodge.filters.webpages.savoy;
3 import com.fasterxml.jackson.annotation.JsonProperty;
5 import java.util.ArrayList;
6 import java.util.Collection;
8 import java.util.Objects;
9 import java.util.stream.Collectors;
11 import static java.lang.String.format;
12 import static java.util.Collections.emptyList;
15 * Information about a movie.
17 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
22 private final String name;
25 private final String imageUrl;
28 private final String description;
31 private final List<Performance> performances = new ArrayList<>();
37 public Movie(String name, String imageUrl) {
38 this(name, imageUrl, "");
41 public Movie(String name, String imageUrl, String description) {
42 this(name, imageUrl, description, emptyList());
45 public Movie(String name, String imageUrl, String description, Collection<Performance> performances) {
47 this.imageUrl = imageUrl;
48 this.description = description;
49 this.performances.addAll(performances);
52 public String getName() {
56 public String getImageUrl() {
60 public String getDescription() {
64 public List<Performance> getPerformances() {
69 public String toString() {
70 return format("%s (%s, %s, %s)", name, imageUrl, description, performances.stream().map(link -> String.format("%s: %s", link.getTime(), link.getLink())).collect(Collectors.joining(", ")));
74 public int hashCode() {
75 return Objects.hash(name, imageUrl, description, performances);
79 public boolean equals(Object o) {
80 if (this == o) return true;
81 if (o == null || getClass() != o.getClass()) return false;
82 Movie movie = (Movie) o;
83 return Objects.equals(name, movie.name) && Objects.equals(imageUrl, movie.imageUrl) && Objects.equals(description, movie.description) && Objects.equals(performances, movie.performances);