2 * Copyright (c) 2003-2005 The BISON Project
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Class that represents one node with a network address. An {@link Network} is
23 * made of a set of nodes. The functionality of this class is thin: it must be
24 * able to represent failure states and store a list of protocols. It is the
25 * protocols that do the interesting job.
27 public interface Node extends Fallible, Cloneable
31 * Prefix of the parameters that defines protocols.
34 public static final String PAR_PROT = "protocol";
37 * Returns the <code>i</code>-th protocol in this node. If <code>i</code>
38 * is not a valid protocol id
39 * (negative or larger than or equal to the number of protocols), then it throws
40 * IndexOutOfBoundsException.
42 public Protocol getProtocol(int i);
45 * Returns the number of protocols included in this node.
47 public int protocolSize();
50 * Sets the index of this node in the internal representation of the node list.
51 * Applications should not use this method. It is defined as public simply
52 * because it is not possible to define it otherwise.
53 * Using this method will result in
54 * undefined behavior. It is provided for the core system.
56 public void setIndex(int index);
59 * Returns the index of this node. It is such that
60 * <code>Network.get(n.getIndex())</code> returns n. This index can
61 * change during a simulation, it is not a fixed id. If you need that, use
65 public int getIndex();
68 * Returns the unique ID of the node. It is guaranteed that the ID is unique
69 * during the entire simulation, that is, there will be no different Node
70 * objects with the same ID in the system during one invocation of the JVM.
72 * should implement <code>hashCode()</code> based on this ID.
77 * Clones the node. It is defined as part of the interface
78 * to change the access right to public and to get rid of the
79 * <code>throws</code> clause.
81 public Object clone();