Change all copyright headers to include 2012.
[Sone.git] / src / main / java / net / pterodactylus / sone / freenet / wot / Trust.java
1 /*
2  * Sone - Trust.java - Copyright © 2010–2012 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.sone.freenet.wot;
19
20 /**
21  * Container class for trust in the web of trust.
22  *
23  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
24  */
25 public class Trust {
26
27         /** Explicitely assigned trust. */
28         private final Integer explicit;
29
30         /** Implicitely calculated trust. */
31         private final Integer implicit;
32
33         /** The distance from the owner of the trust tree. */
34         private final Integer distance;
35
36         /**
37          * Creates a new trust container.
38          *
39          * @param explicit
40          *            The explicit trust
41          * @param implicit
42          *            The implicit trust
43          * @param distance
44          *            The distance
45          */
46         public Trust(Integer explicit, Integer implicit, Integer distance) {
47                 this.explicit = explicit;
48                 this.implicit = implicit;
49                 this.distance = distance;
50         }
51
52         /**
53          * Returns the trust explicitely assigned to an identity.
54          *
55          * @return The explicitely assigned trust, or {@code null} if the identity
56          *         is not in the own identity’s trust tree
57          */
58         public Integer getExplicit() {
59                 return explicit;
60         }
61
62         /**
63          * Returns the implicitely assigned trust, or the calculated trust.
64          *
65          * @return The calculated trust, or {@code null} if the identity is not in
66          *         the own identity’s trust tree
67          */
68         public Integer getImplicit() {
69                 return implicit;
70         }
71
72         /**
73          * Returns the distance of the trusted identity from the trusting identity.
74          *
75          * @return The distance from the own identity, or {@code null} if the
76          *         identity is not in the own identity’s trust tree
77          */
78         public Integer getDistance() {
79                 return distance;
80         }
81
82         /**
83          * {@inheritDoc}
84          */
85         @Override
86         public String toString() {
87                 return getClass().getName() + "[explicit=" + explicit + ",implicit=" + implicit + ",distance=" + distance + "]";
88         }
89
90 }