2 * XdccDownloader - Channel.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;
21 * Defines a channel in a {@link Network}.
23 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
25 public class Channel {
27 /** The network this channel belongs to. */
28 private final Network network;
30 /** The name of the channel. */
31 private final String name;
34 * Creates a new channel.
37 * The network the channel belongs to
39 * The name of the channel
41 public Channel(Network network, String name) {
42 this.network = network;
51 * Returns the network this channel belongs to
53 * @return The network this channel belongs to
55 public Network network() {
60 * Returns the name of this channel.
62 * @return The name of this channel
64 public String name() {
73 public boolean equals(Object object) {
74 if (!(object instanceof Channel)) {
77 Channel channel = (Channel) object;
78 if (!network().equals(channel.network())) {
81 if (!name().equalsIgnoreCase(channel.name())) {
88 public int hashCode() {
89 return network().hashCode() ^ name().hashCode();