2 * XdccDownloader - Server.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 java.util.Collection;
22 import com.google.common.collect.ImmutableSet;
25 * Defines a server in a {@link Network}.
27 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
31 /** The network this server belongs to. */
32 private final Network network;
34 /** The hostname of this server. */
35 private final String hostname;
37 /** The unencrypted port numbers. */
38 private final Collection<Integer> unencryptedPorts;
40 /** The encrypted port numbers. */
41 private final Collection<Integer> encryptedPorts;
44 * Creates a new server.
47 * The network this server belongs to
49 * The hostname of the server
50 * @param unencryptedPorts
51 * The unencrypted port numbers
52 * @param encryptedPorts
53 * The encrypted port numbers
55 public Server(Network network, String hostname, Collection<Integer> unencryptedPorts, Collection<Integer> encryptedPorts) {
56 this.network = network;
57 this.hostname = hostname;
58 this.unencryptedPorts = ImmutableSet.copyOf(unencryptedPorts);
59 this.encryptedPorts = ImmutableSet.copyOf(encryptedPorts);
67 * Returns the network this server belongs to.
69 * @return The network this server belongs to
71 public Network network() {
76 * Returns the hostname of this server.
78 * @return The hostname of this server
80 public String hostname() {
85 * Returns the unencrypted port numbers.
87 * @return The unencrypted port numbers
89 public Collection<Integer> unencryptedPorts() {
90 return unencryptedPorts;
94 * Returns the encrypted port numbers.
96 * @return The encrypted port numbers
98 public Collection<Integer> encryptedPorts() {
99 return encryptedPorts;