Update license to GPLv3, fix header comments
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / SubscribedUSKUpdate.java
1 /*
2  * jFCPlib - SubscribedUSKUpdate.java - Copyright © 2008–2016 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.fcp;
19
20 /**
21  * A “SubscribedUSKUpdate” message is sent each time a new edition of a USK
22  * that was previously subscribed to with {@link SubscribeUSK} was found. Note
23  * that if the new edition that was found is several editions ahead of the
24  * currently last known edition, you will received a SubscribedUSKUpdate for
25  * each edition inbetween as welL!
26  *
27  * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
28  */
29 public class SubscribedUSKUpdate extends BaseMessage implements Identifiable {
30
31         /**
32          * Creates a new “SubscribedUSKUpdate” message that wraps the received
33          * message.
34          *
35          * @param receivedMessage
36          *            The received message
37          */
38         public SubscribedUSKUpdate(FcpMessage receivedMessage) {
39                 super(receivedMessage);
40         }
41
42         /**
43          * Returns the identifier of the subscription.
44          *
45          * @return The identifier of the subscription
46          */
47         @Override
48         public String getIdentifier() {
49                 return getField("Identifier");
50         }
51
52         /**
53          * Returns the new edition that was found.
54          *
55          * @return The new edition
56          */
57         public int getEdition() {
58                 return FcpUtils.safeParseInt(getField("Edition"));
59         }
60
61         /**
62          * Returns the complete URI, including the new edition.
63          *
64          * @return The complete URI
65          */
66         public String getURI() {
67                 return getField("URI");
68         }
69
70 }