Move source and test files to maven’s favourite locations.
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / ARK.java
1 /*
2  * jFCPlib - ARK.java - Copyright © 2008 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 2 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, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18
19 package net.pterodactylus.fcp;
20
21 /**
22  * Container for ARKs (address resolution keys).
23  *
24  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
25  */
26 public class ARK {
27
28         /** The public URI of the ARK. */
29         private final String publicURI;
30
31         /** The private URI of the ARK. */
32         private final String privateURI;
33
34         /** The number of the ARK. */
35         private final int number;
36
37         /**
38          * Creates a new ARK with the given URI and number.
39          *
40          * @param publicURI
41          *            The public URI of the ARK
42          * @param number
43          *            The number of the ARK
44          */
45         public ARK(String publicURI, String number) {
46                 this(publicURI, null, number);
47         }
48
49         /**
50          * Creates a new ARK with the given URIs and number.
51          *
52          * @param publicURI
53          *            The public URI of the ARK
54          * @param privateURI
55          *            The private URI of the ARK
56          * @param number
57          *            The number of the ARK
58          */
59         public ARK(String publicURI, String privateURI, String number) {
60                 if ((publicURI == null) || (number == null)) {
61                         throw new NullPointerException(((publicURI == null) ? "publicURI" : "number") + " must not be null");
62                 }
63                 this.publicURI = publicURI;
64                 this.privateURI = privateURI;
65                 try {
66                         this.number = Integer.valueOf(number);
67                 } catch (NumberFormatException nfe1) {
68                         throw new IllegalArgumentException("number must be numeric", nfe1);
69                 }
70         }
71
72         /**
73          * Returns the public URI of the ARK.
74          *
75          * @return The public URI of the ARK
76          */
77         public String getPublicURI() {
78                 return publicURI;
79         }
80
81         /**
82          * Returns the private URI of the ARK.
83          *
84          * @return The private URI of the ARK
85          */
86         public String getPrivateURI() {
87                 return privateURI;
88         }
89
90         /**
91          * Returns the number of the ARK.
92          *
93          * @return The number of the ARK
94          */
95         public int getNumber() {
96                 return number;
97         }
98
99 }