b2210edec5d32bdfb0df50e0b79391a209c91353
[arachne.git] / src / net / pterodactylus / arachne / core / Edition.java
1 /*
2  * © 2009 David ‘Bombe’ Roden
3  */
4 package net.pterodactylus.arachne.core;
5
6 import de.ina.util.validation.Validation;
7
8 /**
9  * Container for an edition. An edition is (contrary to the usual “freenet
10  * jargon”) a specific edition of a site.
11  *
12  * @author David ‘Bombe’ Roden <bombe@pterodactylus.net>
13  */
14 public class Edition {
15
16         /** The site of the edition. */
17         private final Site site;
18
19         /** The edition number of the edition. */
20         private final int number;
21
22         /**
23          * Creates a new edition.
24          *
25          * @param site
26          *            The site of the edition
27          * @param number
28          *            The edition number of the edition
29          */
30         public Edition(Site site, int number) {
31                 Validation.begin().isNotNull("site", site).isPositive("edition", number).check();
32                 this.site = site;
33                 this.number = number;
34         }
35
36         /**
37          * Returns the site of this edition.
38          *
39          * @return This edition’s site
40          */
41         public Site getSite() {
42                 return site;
43         }
44
45         /**
46          * Returns the edition number of this edition.
47          *
48          * @return This edition’s edition number
49          */
50         public int getNumber() {
51                 return number;
52         }
53
54         //
55         // OBJECT METHODS
56         //
57
58         /**
59          * {@inheritdoc}
60          *
61          * @see java.lang.Object#toString()
62          */
63         @Override
64         public String toString() {
65                 return getClass().getName() + "[site=" + site + ",number=" + number + "]";
66         }
67
68 }