Move WOT-related container classes to top-level classes.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 11 Apr 2014 06:05:42 +0000 (08:05 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Fri, 11 Apr 2014 06:05:48 +0000 (08:05 +0200)
src/main/java/net/pterodactylus/fcp/plugin/CalculatedTrust.java [new file with mode: 0644]
src/main/java/net/pterodactylus/fcp/plugin/Identity.java [new file with mode: 0644]
src/main/java/net/pterodactylus/fcp/plugin/IdentityTrust.java [new file with mode: 0644]
src/main/java/net/pterodactylus/fcp/plugin/OwnIdentity.java [new file with mode: 0644]
src/main/java/net/pterodactylus/fcp/plugin/WebOfTrustPlugin.java

diff --git a/src/main/java/net/pterodactylus/fcp/plugin/CalculatedTrust.java b/src/main/java/net/pterodactylus/fcp/plugin/CalculatedTrust.java
new file mode 100644 (file)
index 0000000..7df10c9
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * jFCPlib - CalculatedTrust.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.pterodactylus.fcp.plugin;
+
+/**
+ * Container that stores the trust that is calculated by taking all trustees
+ * and their trust lists into account.
+ *
+ * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
+ */
+public 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;
+       }
+
+}
diff --git a/src/main/java/net/pterodactylus/fcp/plugin/Identity.java b/src/main/java/net/pterodactylus/fcp/plugin/Identity.java
new file mode 100644 (file)
index 0000000..01c6d48
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * jFCPlib - Identity.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.pterodactylus.fcp.plugin;
+
+/**
+ * Wrapper around a web-of-trust identity.
+ *
+ * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
+ */
+public 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();
+       }
+
+}
diff --git a/src/main/java/net/pterodactylus/fcp/plugin/IdentityTrust.java b/src/main/java/net/pterodactylus/fcp/plugin/IdentityTrust.java
new file mode 100644 (file)
index 0000000..aff79ee
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * jFCPlib - IdentityTrust.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.pterodactylus.fcp.plugin;
+
+/**
+ * Container for the trust given from one identity to another.
+ *
+ * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
+ */
+public 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;
+       }
+
+}
diff --git a/src/main/java/net/pterodactylus/fcp/plugin/OwnIdentity.java b/src/main/java/net/pterodactylus/fcp/plugin/OwnIdentity.java
new file mode 100644 (file)
index 0000000..ec4b217
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * jFCPlib - OwnIdentity.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.pterodactylus.fcp.plugin;
+
+/**
+ * Wrapper around a web-of-trust own identity.
+ *
+ * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
+ */
+public 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;
+       }
+
+}
index 3e99b1e..e83b071 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * 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
  *
  * 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
@@ -429,233 +429,4 @@ public class WebOfTrustPlugin {
                return parameterMap;
        }
 
                return parameterMap;
        }
 
-       /**
-        * Wrapper around a web-of-trust identity.
-        *
-        * @author David ‘Bombe’ Roden &lt;bombe@freenetproject.org&gt;
-        */
-       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 &lt;bombe@freenetproject.org&gt;
-        */
-       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 &lt;bombe@freenetproject.org&gt;
-        */
-       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 &lt;bombe@freenetproject.org&gt;
-        */
-       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;
-               }
-
-       }
-
 }
 }