Format printed channels nicely.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / data / Server.java
1 /*
2  * XdccDownloader - Server.java - Copyright © 2013 David Roden
3  *
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.
8  *
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.
13  *
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/>.
16  */
17
18 package net.pterodactylus.xdcc.data;
19
20 import java.util.Collection;
21
22 import com.google.common.collect.ImmutableSet;
23
24 /**
25  * Defines a server in a {@link Network}.
26  *
27  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
28  */
29 public class Server {
30
31         /** The network this server belongs to. */
32         private final Network network;
33
34         /** The hostname of this server. */
35         private final String hostname;
36
37         /** The unencrypted port numbers. */
38         private final Collection<Integer> unencryptedPorts;
39
40         /** The encrypted port numbers. */
41         private final Collection<Integer> encryptedPorts;
42
43         /**
44          * Creates a new server.
45          *
46          * @param network
47          *              The network this server belongs to
48          * @param hostname
49          *              The hostname of the server
50          * @param unencryptedPorts
51          *              The unencrypted port numbers
52          * @param encryptedPorts
53          *              The encrypted port numbers
54          */
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);
60         }
61
62         //
63         // ACCESSORS
64         //
65
66         /**
67          * Returns the network this server belongs to.
68          *
69          * @return The network this server belongs to
70          */
71         public Network network() {
72                 return network;
73         }
74
75         /**
76          * Returns the hostname of this server.
77          *
78          * @return The hostname of this server
79          */
80         public String hostname() {
81                 return hostname;
82         }
83
84         /**
85          * Returns the unencrypted port numbers.
86          *
87          * @return The unencrypted port numbers
88          */
89         public Collection<Integer> unencryptedPorts() {
90                 return unencryptedPorts;
91         }
92
93         /**
94          * Returns the encrypted port numbers.
95          *
96          * @return The encrypted port numbers
97          */
98         public Collection<Integer> encryptedPorts() {
99                 return encryptedPorts;
100         }
101
102 }