2 * Sone - Trust.java - Copyright © 2010 David Roden
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.
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.
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/>.
18 package net.pterodactylus.sone.freenet.wot;
21 * Container class for trust in the web of trust.
23 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
27 /** Explicitely assigned trust. */
28 private final Integer explicit;
30 /** Implicitely calculated trust. */
31 private final Integer implicit;
33 /** The distance from the owner of the trust tree. */
34 private final Integer distance;
37 * Creates a new trust container.
46 public Trust(Integer explicit, Integer implicit, Integer distance) {
47 this.explicit = explicit;
48 this.implicit = implicit;
49 this.distance = distance;
53 * Returns the trust explicitely assigned to an identity.
55 * @return The explicitely assigned trust, or {@code null} if the identity
56 * is not in the own identity’s trust tree
58 public Integer getExplicit() {
63 * Returns the implicitely assigned trust, or the calculated trust.
65 * @return The calculated trust, or {@code null} if the identity is not in
66 * the own identity’s trust tree
68 public Integer getImplicit() {
73 * Returns the distance of the trusted identity from the trusting identity.
75 * @return The distance from the own identity, or {@code null} if the
76 * identity is not in the own identity’s trust tree
78 public Integer getDistance() {
86 public String toString() {
87 return getClass().getName() + "[explicit=" + explicit + ",implicit=" + implicit + ",distance=" + distance + "]";