2 * XdccDownloader - Pack.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.xdcc.data;
20 import static com.google.common.base.Preconditions.checkNotNull;
23 * A pack is a downloadable file offered by a {@link Bot}.
25 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
29 /** The ID of the pack. */
30 private final String id;
32 /** The size of the pack. */
33 private final String size;
35 /** The name of the pack. */
36 private final String name;
44 * The size of the pack
46 * The name of the pack
48 public Pack(String id, String size, String name) {
49 this.id = checkNotNull(id, "id must not be null");
50 this.size = checkNotNull(size, "size must not be null");
51 this.name = checkNotNull(name, "name must not be null");
59 * Returns the ID of the pack. The ID is only guaranteed to be unique within a
62 * @return The ID of the pack
69 * Returns the size of the pack. The size can contain decimal fractions and
70 * unit denotifiers, such as “1.2G”.
72 * @return The size of the pack
74 public String size() {
79 * Returns the name of the pack. This is usually the name of the single file
80 * that makes up this pack.
82 * @return The name of the pack
84 public String name() {
93 public boolean equals(Object object) {
94 if (!(object instanceof Pack)) {
97 Pack pack = (Pack) object;
98 return id().equals(pack.id()) && name().equals(pack.name());
102 public int hashCode() {
103 return id().hashCode() ^ name().hashCode();