|
| 1 | +package com.pengrad.telegrambot.model; |
| 2 | + |
| 3 | +import java.util.Arrays; |
| 4 | + |
| 5 | +/** |
| 6 | + * Stas Parshin |
| 7 | + * 03 October 2016 |
| 8 | + */ |
| 9 | +public class Game { |
| 10 | + |
| 11 | + private String title; |
| 12 | + private String description; |
| 13 | + private PhotoSize[] photo; |
| 14 | + |
| 15 | + private String text; |
| 16 | + private MessageEntity[] text_entities; |
| 17 | + private Animation animation; |
| 18 | + |
| 19 | + public String title() { |
| 20 | + return title; |
| 21 | + } |
| 22 | + |
| 23 | + public String description() { |
| 24 | + return description; |
| 25 | + } |
| 26 | + |
| 27 | + public PhotoSize[] photo() { |
| 28 | + return photo; |
| 29 | + } |
| 30 | + |
| 31 | + public String text() { |
| 32 | + return text; |
| 33 | + } |
| 34 | + |
| 35 | + public MessageEntity[] textEntities() { |
| 36 | + return text_entities; |
| 37 | + } |
| 38 | + |
| 39 | + public Animation animation() { |
| 40 | + return animation; |
| 41 | + } |
| 42 | + |
| 43 | + @Override |
| 44 | + public boolean equals(Object o) { |
| 45 | + if (this == o) return true; |
| 46 | + if (o == null || getClass() != o.getClass()) return false; |
| 47 | + |
| 48 | + Game game = (Game) o; |
| 49 | + |
| 50 | + if (!title.equals(game.title)) return false; |
| 51 | + if (!description.equals(game.description)) return false; |
| 52 | + // Probably incorrect - comparing Object[] arrays with Arrays.equals |
| 53 | + if (!Arrays.equals(photo, game.photo)) return false; |
| 54 | + if (text != null ? !text.equals(game.text) : game.text != null) return false; |
| 55 | + // Probably incorrect - comparing Object[] arrays with Arrays.equals |
| 56 | + if (!Arrays.equals(text_entities, game.text_entities)) return false; |
| 57 | + if (animation != null ? !animation.equals(game.animation) : game.animation != null) return false; |
| 58 | + |
| 59 | + return true; |
| 60 | + } |
| 61 | + |
| 62 | + @Override |
| 63 | + public int hashCode() { |
| 64 | + int result = title.hashCode(); |
| 65 | + result = 31 * result + description.hashCode(); |
| 66 | + result = 31 * result + Arrays.hashCode(photo); |
| 67 | + result = 31 * result + (text != null ? text.hashCode() : 0); |
| 68 | + result = 31 * result + Arrays.hashCode(text_entities); |
| 69 | + result = 31 * result + (animation != null ? animation.hashCode() : 0); |
| 70 | + return result; |
| 71 | + } |
| 72 | + |
| 73 | + @Override |
| 74 | + public String toString() { |
| 75 | + return "Game{" + |
| 76 | + "title='" + title + '\'' + |
| 77 | + ", description='" + description + '\'' + |
| 78 | + ", photo=" + Arrays.toString(photo) + |
| 79 | + ", text='" + text + '\'' + |
| 80 | + ", text_entities=" + Arrays.toString(text_entities) + |
| 81 | + ", animation=" + animation + |
| 82 | + '}'; |
| 83 | + } |
| 84 | +} |
0 commit comments