X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FNode.java;h=5a8ec89332037846a83879ad0104b8fde7114ef7;hb=464bd5d54b6b55a84dd7245f48164ec0a72cd49c;hp=b7359ca9965c92448b78a4cbf84cb615fcbde7df;hpb=ce32d41fc7a9b72674d2bb42d0064293b38f06db;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/Node.java b/src/net/pterodactylus/jsite/core/Node.java index b7359ca..5a8ec89 100644 --- a/src/net/pterodactylus/jsite/core/Node.java +++ b/src/net/pterodactylus/jsite/core/Node.java @@ -22,14 +22,12 @@ package net.pterodactylus.jsite.core; import java.beans.PropertyChangeListener; import net.pterodactylus.util.beans.AbstractBean; -import net.pterodactylus.util.beans.Comparer; /** * Container for a Freenet node. A Node is capable of notifying * {@link PropertyChangeListener}s if any of the contained properties change. * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - * @version $Id$ */ public class Node extends AbstractBean { @@ -42,6 +40,9 @@ public class Node extends AbstractBean { /** Name of the “port” property. */ public static final String PROPERTY_PORT = "port"; + /** Internal ID. */ + private String id; + /** The name of the node. */ private String name; @@ -51,9 +52,24 @@ public class Node extends AbstractBean { /** The port number of the node. */ private int port; - // - // EVENT MANAGEMENT - // + /** + * Returns the internal ID of the node. + * + * @return The internal ID of the node + */ + String getId() { + return id; + } + + /** + * Sets the internal ID of the node. + * + * @param id + * The internal ID of the node + */ + void setId(String id) { + this.id = id; + } /** * Returns the user-given name of the node. @@ -73,9 +89,7 @@ public class Node extends AbstractBean { public void setName(String name) { String oldName = this.name; this.name = name; - if (!Comparer.equal(oldName, name)) { - firePropertyChange(PROPERTY_NAME, oldName, name); - } + fireIfPropertyChanged(PROPERTY_NAME, oldName, name); } /** @@ -96,9 +110,7 @@ public class Node extends AbstractBean { public void setHostname(String hostname) { String oldHostname = this.hostname; this.hostname = hostname; - if (!Comparer.equal(oldHostname, hostname)) { - firePropertyChange(PROPERTY_HOSTNAME, oldHostname, hostname); - } + fireIfPropertyChanged(PROPERTY_HOSTNAME, oldHostname, hostname); } /** @@ -119,9 +131,7 @@ public class Node extends AbstractBean { public void setPort(int port) { int oldPort = this.port; this.port = port; - if (oldPort != port) { - firePropertyChange(PROPERTY_PORT, oldPort, port); - } + fireIfPropertyChanged(PROPERTY_PORT, oldPort, port); } /**