From: David ‘Bombe’ Roden Date: Wed, 8 Jun 2011 10:26:49 +0000 (+0200) Subject: Add javadoc comments, remove obsolete imports. X-Git-Tag: 0.6.5^2~9^2~8 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a170ca4a7b77749951028f691ab126cd507a96fa;p=Sone.git Add javadoc comments, remove obsolete imports. --- diff --git a/src/main/java/net/pterodactylus/sone/text/FreenetLinkPart.java b/src/main/java/net/pterodactylus/sone/text/FreenetLinkPart.java index 2efb380..be3aef9 100644 --- a/src/main/java/net/pterodactylus/sone/text/FreenetLinkPart.java +++ b/src/main/java/net/pterodactylus/sone/text/FreenetLinkPart.java @@ -18,23 +18,57 @@ package net.pterodactylus.sone.text; /** - * TODO + * {@link LinkPart} implementation that stores an additional attribute: if the + * link is an SSK or USK link and the post was created by an identity that owns + * the keyspace in question. * * @author David ‘Bombe’ Roden */ public class FreenetLinkPart extends LinkPart { + /** Whether the link is trusted. */ private final boolean trusted; + /** + * Creates a new freenet link part. + * + * @param link + * The link of the part + * @param text + * The text of the part + * @param trusted + * {@code true} if the link is trusted, {@code false} otherwise + */ public FreenetLinkPart(String link, String text, boolean trusted) { this(link, text, text, trusted); } + /** + * Creates a new freenet link part. + * + * @param link + * The link of the part + * @param text + * The text of the part + * @param title + * The title of the part + * @param trusted + * {@code true} if the link is trusted, {@code false} otherwise + */ public FreenetLinkPart(String link, String text, String title, boolean trusted) { super(link, text, title); this.trusted = trusted; } + // + // ACCESSORS + // + + /** + * Returns whether the link is trusted. + * + * @return {@code true} if the link is trusted, {@code false} otherwise + */ public boolean isTrusted() { return trusted; } diff --git a/src/main/java/net/pterodactylus/sone/text/LinkPart.java b/src/main/java/net/pterodactylus/sone/text/LinkPart.java index d911bbd..d5da730 100644 --- a/src/main/java/net/pterodactylus/sone/text/LinkPart.java +++ b/src/main/java/net/pterodactylus/sone/text/LinkPart.java @@ -18,20 +18,45 @@ package net.pterodactylus.sone.text; /** - * TODO + * {@link Part} implementation that can hold a link. A link contains of three + * attributes: the link itself, the text that is shown instead of the link, and + * an explanatory text that can be displayed e.g. as a tooltip. * * @author David ‘Bombe’ Roden */ public class LinkPart implements Part { + /** The link of this part. */ private final String link; + + /** The text of this part. */ private final String text; + + /** The title of this part. */ private final String title; + /** + * Creates a new link part. + * + * @param link + * The link of the link part + * @param text + * The text of the link part + */ public LinkPart(String link, String text) { this(link, text, text); } + /** + * Creates a new link part. + * + * @param link + * The link of the link part + * @param text + * The text of the link part + * @param title + * The title of the link part + */ public LinkPart(String link, String text, String title) { this.link = link; this.text = text; @@ -42,14 +67,29 @@ public class LinkPart implements Part { // ACCESSORS // + /** + * Returns the link of this part. + * + * @return The link of this part + */ public String getLink() { return link; } + /** + * Returns the text of this part. + * + * @return The text of this part + */ public String getText() { return text; } + /** + * Returns the title of this part. + * + * @return The title of this part + */ public String getTitle() { return title; } diff --git a/src/main/java/net/pterodactylus/sone/text/PlainTextPart.java b/src/main/java/net/pterodactylus/sone/text/PlainTextPart.java index 4870bc4..a1f2088 100644 --- a/src/main/java/net/pterodactylus/sone/text/PlainTextPart.java +++ b/src/main/java/net/pterodactylus/sone/text/PlainTextPart.java @@ -17,21 +17,22 @@ package net.pterodactylus.sone.text; -import java.io.IOException; -import java.io.Writer; -import java.util.Iterator; - -import net.pterodactylus.util.collection.ObjectIterator; - /** - * TODO + * {@link Part} implementation that holds a single piece of text. * * @author David ‘Bombe’ Roden */ public class PlainTextPart implements Part { + /** The text of the part. */ private final String text; + /** + * Creates a new plain-text part. + * + * @param text + * The text of the part + */ public PlainTextPart(String text) { this.text = text; } @@ -40,6 +41,11 @@ public class PlainTextPart implements Part { // ACCESSORS // + /** + * Returns the text of this part. + * + * @return The text of this part + */ public String getText() { return text; } diff --git a/src/main/java/net/pterodactylus/sone/text/PostPart.java b/src/main/java/net/pterodactylus/sone/text/PostPart.java index 1e0773d..22acd43 100644 --- a/src/main/java/net/pterodactylus/sone/text/PostPart.java +++ b/src/main/java/net/pterodactylus/sone/text/PostPart.java @@ -20,18 +20,34 @@ package net.pterodactylus.sone.text; import net.pterodactylus.sone.data.Post; /** - * TODO + * {@link Part} implementation that stores a reference to a {@link Post}. * * @author David ‘Bombe’ Roden */ public class PostPart implements Part { + /** The post this part refers to. */ private final Post post; + /** + * Creates a new post part. + * + * @param post + * The referenced post + */ public PostPart(Post post) { this.post = post; } + // + // ACCESSORS + // + + /** + * Returns the post referenced by this part. + * + * @return The post referenced by this part + */ public Post getPost() { return post; } diff --git a/src/main/java/net/pterodactylus/sone/text/SonePart.java b/src/main/java/net/pterodactylus/sone/text/SonePart.java index b460a29..5c6a63d 100644 --- a/src/main/java/net/pterodactylus/sone/text/SonePart.java +++ b/src/main/java/net/pterodactylus/sone/text/SonePart.java @@ -18,21 +18,36 @@ package net.pterodactylus.sone.text; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.template.SoneAccessor; /** - * TODO + * {@link Part} implementation that stores a reference to a {@link Sone}. * * @author David ‘Bombe’ Roden */ public class SonePart implements Part { + /** The referenced {@link Sone}. */ private final Sone sone; + /** + * Creates a new Sone part. + * + * @param sone + * The referenced Sone + */ public SonePart(Sone sone) { this.sone = sone; } + // + // ACCESSORS + // + + /** + * Returns the referenced Sone. + * + * @return The referenced Sone + */ public Sone getSone() { return sone; } diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index dede0ac..68a32d0 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -20,10 +20,7 @@ package net.pterodactylus.sone.text; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; -import java.io.StringReader; -import java.io.Writer; import java.net.MalformedURLException; -import java.util.Iterator; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; @@ -32,11 +29,7 @@ import java.util.regex.Pattern; import net.pterodactylus.sone.core.Core; import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.template.SoneAccessor; import net.pterodactylus.util.logging.Logging; -import net.pterodactylus.util.template.Template; -import net.pterodactylus.util.template.TemplateContextFactory; -import net.pterodactylus.util.template.TemplateParser; import freenet.keys.FreenetURI; /**