fb808271c1287b00cd88b1e62f41d837e73b8bff
[jSite2.git] / src / net / pterodactylus / util / fcp / ARK.java
1 package net.pterodactylus.util.fcp;
2
3 /**
4  * Container for ARKs (address resolution keys).
5  * 
6  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
7  * @version $Id$
8  */
9 public class ARK {
10
11         /** The public URI of the ARK. */
12         private final String publicURI;
13
14         /** The private URI of the ARK. */
15         private final String privateURI;
16
17         /** The number of the ARK. */
18         private final int number;
19
20         /**
21          * Creates a new ARK with the given URI and number.
22          * 
23          * @param publicURI
24          *            The public URI of the ARK
25          * @param number
26          *            The number of the ARK
27          */
28         public ARK(String publicURI, String number) {
29                 this(publicURI, null, number);
30         }
31
32         /**
33          * Creates a new ARK with the given URIs and number.
34          * 
35          * @param publicURI
36          *            The public URI of the ARK
37          * @param privateURI
38          *            The private URI of the ARK
39          * @param number
40          *            The number of the ARK
41          */
42         public ARK(String publicURI, String privateURI, String number) {
43                 if ((publicURI == null) || (number == null)) {
44                         throw new NullPointerException(((publicURI == null) ? "publicURI" : "number") + " must not be null");
45                 }
46                 this.publicURI = publicURI;
47                 this.privateURI = privateURI;
48                 try {
49                         this.number = Integer.valueOf(number);
50                 } catch (NumberFormatException nfe1) {
51                         throw new IllegalArgumentException("number must be numeric", nfe1);
52                 }
53         }
54
55         /**
56          * Returns the public URI of the ARK.
57          * 
58          * @return The public URI of the ARK
59          */
60         public String getPublicURI() {
61                 return publicURI;
62         }
63
64         /**
65          * Returns the private URI of the ARK.
66          * 
67          * @return The private URI of the ARK
68          */
69         public String getPrivateURI() {
70                 return privateURI;
71         }
72
73         /**
74          * Returns the number of the ARK.
75          * 
76          * @return The number of the ARK
77          */
78         public int getNumber() {
79                 return number;
80         }
81
82 }