From bb06e6cf5cdf324018de4e6ad76c21a39affa1f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 22 Jun 2008 12:57:21 +0200 Subject: [PATCH] add javadoc --- src/de/todesbaum/jsite/application/Node.java | 76 ++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/src/de/todesbaum/jsite/application/Node.java b/src/de/todesbaum/jsite/application/Node.java index 8a486b8..d507311 100644 --- a/src/de/todesbaum/jsite/application/Node.java +++ b/src/de/todesbaum/jsite/application/Node.java @@ -20,63 +20,120 @@ package de.todesbaum.jsite.application; /** + * Container for node information. + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ public class Node extends de.todesbaum.util.freenet.fcp2.Node { + /** The name of the node. */ protected String name; /** + * Creates a new node with the given hostname and the default port. + * + * @see de.todesbaum.util.freenet.fcp2.Node#DEFAULT_PORT * @param hostname + * The hostname of the new node */ public Node(String hostname) { this(hostname, DEFAULT_PORT); } /** + * Creates a new node with the given hostname and port. + * * @param hostname + * The hostname of the new node * @param port + * The port of the new node */ public Node(String hostname, int port) { this(hostname, port, ""); } + /** + * Creates a new node with the given hostname, port, and name. + * + * @param hostname + * The hostname of the new node + * @param port + * The port of the new node + * @param name + * The name of the node + */ public Node(String hostname, int port, String name) { super(hostname, port); this.name = name; } + /** + * Creates a new node that gets its settings from the given node. + * + * @param node + * The node to copy + */ public Node(Node node) { this(node.getHostname(), node.getPort()); } + /** + * Creates a new node from the given node, overwriting the name. + * + * @param node + * The node to copy from + * @param name + * The new name of the node + */ public Node(Node node, String name) { this(node.getHostname(), node.getPort(), name); } /** + * Sets the name of the node. + * * @param name - * The name to set. + * The name of the node */ public void setName(String name) { this.name = name; } /** - * @return Returns the name. + * Returns the name of the node. + * + * @return The name of the node */ public String getName() { return name; } + /** + * Sets the hostname of the node. + * + * @param hostname + * The hostname of the node + */ public void setHostname(String hostname) { this.hostname = hostname; } + /** + * Sets the port of the node. + * + * @param port + * The port of the node + */ public void setPort(int port) { this.port = port; } - + + /** + * {@inheritDoc} + *

+ * A node is considered as being equal to this node its name, hostname, and + * port equal their counterparts in this node. + */ @Override public boolean equals(Object o) { if ((o == null) || !(o instanceof Node)) { @@ -85,12 +142,23 @@ public class Node extends de.todesbaum.util.freenet.fcp2.Node { Node node = (Node) o; return name.equals(node.name) && hostname.equals(node.hostname) && (port == node.port); } - + + /** + * {@inheritDoc} + *

+ * The hashcode for a node is created from its name, its hostname, and its + * port. + */ @Override public int hashCode() { return name.hashCode() ^ hostname.hashCode() ^ port; } + /** + * {@inheritDoc} + *

+ * Creates a textual representation of this node. + */ @Override public String toString() { return name + " (" + hostname + ":" + port + ")"; -- 2.7.4