Author: batosai
Date: 2008-09-22 15:37:47 +0000 (Mon, 22 Sep 2008)
New Revision: 22738
Modified:
trunk/plugins/WoT/Trust.java
trunk/plugins/WoT/Trustlist.java
Log:
Javadoc.
Modified: trunk/plugins/WoT/Trust.java
===================================================================
--- trunk/plugins/WoT/Trust.java 2008-09-22 15:24:44 UTC (rev 22737)
+++ trunk/plugins/WoT/Trust.java 2008-09-22 15:37:47 UTC (rev 22738)
@@ -14,7 +14,7 @@
import com.db4o.ObjectSet;
/**
- * A trust relationship between two identities
+ * A trust relationship between two Identities
*
* @author Julien Cornuwel (batosai at freenetproject.org)
*
@@ -30,7 +30,15 @@
private int value;
private String comment;
-
+ /**
+ * Creates a Trust from given parameters.
+ *
+ * @param truster Identity that gives the trust
+ * @param trustee Identity that receives the trust
+ * @param value Numeric value of the Trust
+ * @param comment A comment to explain the numeric trust value
+ * @throws InvalidParameterException if the trust value is not between
-100 and +100
+ */
public Trust(Identity truster, Identity trustee, int value, String
comment) throws InvalidParameterException {
this.truster = truster;
this.trustee = trustee;
@@ -38,11 +46,23 @@
setComment(comment);
}
+ /**
+ * Counts the number of Trust objects stored in the database
+ *
+ * @param db A reference to the database
+ * @return the number of Trust objects stored in the database
+ */
public static int getNb(ObjectContainer db) {
ObjectSet<Trust> trusts = db.queryByExample(Trust.class);
return trusts.size();
}
+ /**
+ * Exports this trust relationship to XML format.
+ *
+ * @param xmlDoc the XML {@link Document} this trust will be inserted
in
+ * @return The XML {@link Element} describing this trust relationship
+ */
public Element toXML(Document xmlDoc) {
Element elem = xmlDoc.createElement("trust");
elem.setAttribute("uri", trustee.getRequestURI().toString());
@@ -57,42 +77,42 @@
}
/**
- * @return truster
+ * @return The Identity that gives this trust
*/
public Identity getTruster() {
return truster;
}
/**
- * @param truster Identity that gives the trust
+ * @param truster Identity that gives this trust
*/
public void setTruster(Identity truster) {
this.truster = truster;
}
/**
- * @return trustee
+ * @return trustee The Identity that receives this trust
*/
public Identity getTrustee() {
return trustee;
}
/**
- * @param trustee Identity that receives the trust
+ * @param trustee Identity that receives this trust
*/
public void setTrustee(Identity trustee) {
this.trustee = trustee;
}
/**
- * @return value
+ * @return value Numeric value of this trust relationship
*/
public int getValue() {
return value;
}
/**
- * @param value Numeric value of the trust [-100;+100]
+ * @param value Numeric value of this trust relationship [-100;+100]
* @throws InvalidParameterException if value isn't in the range
*/
public void setValue(int value) throws InvalidParameterException {
@@ -103,16 +123,14 @@
}
/**
- *
- * @return Comment
+ * @return comment The comment associated to this Trust relationship
*/
public String getComment() {
return comment;
}
/**
- *
- * @param comment Comment on that trust relationship
+ * @param comment Comment on this trust relationship
*/
public void setComment(String comment) {
this.comment = comment;
Modified: trunk/plugins/WoT/Trustlist.java
===================================================================
--- trunk/plugins/WoT/Trustlist.java 2008-09-22 15:24:44 UTC (rev 22737)
+++ trunk/plugins/WoT/Trustlist.java 2008-09-22 15:37:47 UTC (rev 22738)
@@ -16,7 +16,8 @@
import com.db4o.ext.Db4oIOException;
/**
- * TrustList of an Identity
+ * A list of all Trusts given by an Identity
+ *
* @author Julien Cornuwel (batosai at freenetproject.org)
*
*/
@@ -27,8 +28,8 @@
/**
* Creates the trustlist of a local Identity
*
- * @param db Connection to db4o
- * @param truster Identity that owns that trustList
+ * @param db A reference to the Database
+ * @param truster Identity that owns this trustList
* @throws InvalidParameterException
* @throws DatabaseClosedException
* @throws Db4oIOException
@@ -39,6 +40,7 @@
/**
* Returns an XML Element containing the trustList
+ *
* @param xmlDoc The XML Document
* @return Element containing details of the trustList
*/