3 * Copyright (C) 2006 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package de.todesbaum.jsite.application;
23 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
25 public class Node extends de.todesbaum.util.freenet.fcp2.Node {
27 protected String name;
32 public Node(String hostname) {
33 this(hostname, DEFAULT_PORT);
40 public Node(String hostname, int port) {
41 this(hostname, port, "");
44 public Node(String hostname, int port, String name) {
45 super(hostname, port);
49 public Node(Node node) {
50 this(node.getHostname(), node.getPort());
53 public Node(Node node, String name) {
54 this(node.getHostname(), node.getPort(), name);
61 public void setName(String name) {
66 * @return Returns the name.
68 public String getName() {
72 public void setHostname(String hostname) {
73 this.hostname = hostname;
76 public void setPort(int port) {
81 public boolean equals(Object o) {
82 if ((o == null) || !(o instanceof Node)) {
86 return name.equals(node.name) && hostname.equals(node.hostname) && (port == node.port);
90 public int hashCode() {
91 return name.hashCode() ^ hostname.hashCode() ^ port;
95 public String toString() {
96 return name + " (" + hostname + ":" + port + ")";