X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FNode.java;h=b3a98e9980659081e15f4638706d9ac30b534560;hb=7e16d0a3b4f15da04f665fc011f78af2bc93a13d;hp=37664985d8ff2ff9269283060432912dba07e47c;hpb=811c8f26e0ea0f1418451acb34ddabedafdbc3b3;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/Node.java b/src/net/pterodactylus/jsite/core/Node.java index 3766498..b3a98e9 100644 --- a/src/net/pterodactylus/jsite/core/Node.java +++ b/src/net/pterodactylus/jsite/core/Node.java @@ -21,7 +21,7 @@ package net.pterodactylus.jsite.core; /** * Container for a Freenet node. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> * @version $Id$ */ @@ -38,7 +38,7 @@ public class Node { /** * Returns the user-given name of the node. - * + * * @return The name of the node */ public String getName() { @@ -47,7 +47,7 @@ public class Node { /** * Sets the user-given name of the node. - * + * * @param name * The name of the node */ @@ -57,7 +57,7 @@ public class Node { /** * Returns the hostname of the node. - * + * * @return The hostname of the node */ public String getHostname() { @@ -66,7 +66,7 @@ public class Node { /** * Sets the hostname of the node. - * + * * @param hostname * The hostname of the node */ @@ -76,7 +76,7 @@ public class Node { /** * Returns the port number of the node. - * + * * @return The port number of the node */ public int getPort() { @@ -85,7 +85,7 @@ public class Node { /** * Sets the port number of the node. - * + * * @param port * The port number of the node */ @@ -93,4 +93,25 @@ public class Node { this.port = port; } + /** + * {@inheritDoc} Two Node objects are considered equal if their hostnames + * and their port numbers are equal. + */ + @Override + public boolean equals(Object object) { + if ((object == null) || !(object instanceof Node)) { + return false; + } + Node node = (Node) object; + return hostname.equals(node.hostname) && port == node.port; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return name + " (" + hostname + ((port == 9481) ? ("") : (":" + port)) + ")"; + } + }