/*
- * jFCPlib - WebOfTrustPlugin.java - Copyright © 2009 David Roden
+ * jFCPlib - WebOfTrustPlugin.java - Copyright © 2009–2014 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return parameterMap;
}
- /**
- * Wrapper around a web-of-trust identity.
- *
- * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- */
- public static class Identity {
-
- /** The identity’s identifier. */
- private final String identifier;
-
- /** The identity’s nickname. */
- private final String nickname;
-
- /** The identity’s request URI. */
- private final String requestUri;
-
- /**
- * Creates a new identity.
- *
- * @param identifier
- * The identifies of the identity
- * @param nickname
- * The nickname of the identity
- * @param requestUri
- * The request URI of the identity
- */
- public Identity(String identifier, String nickname, String requestUri) {
- this.identifier = identifier;
- this.nickname = nickname;
- this.requestUri = requestUri;
- }
-
- /**
- * Returns the identifier of this identity.
- *
- * @return This identity’s identifier
- */
- public String getIdentifier() {
- return identifier;
- }
-
- /**
- * Returns the nickname of this identity.
- *
- * @return This identity’s nickname
- */
- public String getNickname() {
- return nickname;
- }
-
- /**
- * Returns the request URI of this identity.
- *
- * @return This identity’s request URI
- */
- public String getRequestUri() {
- return requestUri;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if ((obj == null) || (obj.getClass() != this.getClass())) {
- return false;
- }
- Identity identity = (Identity) obj;
- return identifier.equals(identity.identifier);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return identifier.hashCode();
- }
-
- }
-
- /**
- * Container for the trust given from one identity to another.
- *
- * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- */
- public static class IdentityTrust {
-
- /** The trust given to the identity. */
- private final byte trust;
-
- /** The command for the trust value. */
- private final String comment;
-
- /**
- * Creates a new identity trust container.
- *
- * @param trust
- * The trust given to the identity
- * @param comment
- * The comment for the trust value
- */
- public IdentityTrust(byte trust, String comment) {
- this.trust = trust;
- this.comment = comment;
- }
-
- /**
- * Returns the trust value given to the identity.
- *
- * @return The trust value
- */
- public byte getTrust() {
- return trust;
- }
-
- /**
- * Returns the comment for the trust value.
- *
- * @return The comment for the trust value
- */
- public String getComment() {
- return comment;
- }
-
- }
-
- /**
- * Container that stores the trust that is calculated by taking all trustees
- * and their trust lists into account.
- *
- * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- */
- public static class CalculatedTrust {
-
- /** The calculated trust value. */
- private final Byte trust;
-
- /** The calculated score value. */
- private final Integer score;
-
- /** The calculated rank. */
- private final Integer rank;
-
- /**
- * Creates a new calculated trust container.
- *
- * @param trust
- * The calculated trust value
- * @param score
- * The calculated score value
- * @param rank
- * The calculated rank of the
- */
- public CalculatedTrust(Byte trust, Integer score, Integer rank) {
- this.trust = trust;
- this.score = score;
- this.rank = rank;
- }
-
- /**
- * Returns the calculated trust value.
- *
- * @return The calculated trust value, or {@code null} if the trust
- * value is not known
- */
- public Byte getTrust() {
- return trust;
- }
-
- /**
- * Returns the calculated score value.
- *
- * @return The calculated score value, or {@code null} if the score
- * value is not known
- */
- public Integer getScore() {
- return score;
- }
-
- /**
- * Returns the calculated rank.
- *
- * @return The calculated rank, or {@code null} if the rank is not known
- */
- public Integer getRank() {
- return rank;
- }
-
- }
-
- /**
- * Wrapper around a web-of-trust own identity.
- *
- * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
- */
- public static class OwnIdentity extends Identity {
-
- /** The identity’s insert URI. */
- private final String insertUri;
-
- /**
- * Creates a new web-of-trust own identity.
- *
- * @param identifier
- * The identifier of the identity
- * @param nickname
- * The nickname of the identity
- * @param requestUri
- * The request URI of the identity
- * @param insertUri
- * The insert URI of the identity
- */
- public OwnIdentity(String identifier, String nickname, String requestUri, String insertUri) {
- super(identifier, nickname, requestUri);
- this.insertUri = insertUri;
- }
-
- /**
- * Returns the insert URI of this identity.
- *
- * @return This identity’s insert URI
- */
- public String getInsertUri() {
- return insertUri;
- }
-
- }
-
}