peersim.core
Interface Node

All Superinterfaces:
java.lang.Cloneable, Fallible
All Known Implementing Classes:
GeneralNode, ModifiableNode

public interface Node
extends Fallible, java.lang.Cloneable

Class that represents one node with a network address. An Network is made of a set of nodes. The functionality of this class is thin: it must be able to represent failure states and store a list of protocols. It is the protocols that do the interesting job.


Parameter Summary
protocol
          Prefix of the parameters that defines protocols.
 
Field Summary
 
Fields inherited from interface peersim.core.Fallible
DEAD, DOWN, OK
 
Method Summary
abstract  java.lang.Object clone()
          Clones the node.
abstract  long getID()
          Returns the unique ID of the node.
abstract  int getIndex()
          Returns the index of this node.
abstract  Protocol getProtocol(int i)
          Returns the i-th protocol in this node.
abstract  int protocolSize()
          Returns the number of protocols included in this node.
abstract  void setIndex(int index)
          Sets the index of this node in the internal representation of the node list.
 
Methods inherited from interface peersim.core.Fallible
getFailState, isUp, setFailState
 

Parameter Detail

protocol

Prefix of the parameters that defines protocols.

Method Detail

getProtocol

Protocol getProtocol(int i)
Returns the i-th protocol in this node. If i is not a valid protocol id (negative or larger than or equal to the number of protocols), then it throws IndexOutOfBoundsException.


protocolSize

int protocolSize()
Returns the number of protocols included in this node.


setIndex

void setIndex(int index)
Sets the index of this node in the internal representation of the node list. Applications should not use this method. It is defined as public simply because it is not possible to define it otherwise. Using this method will result in undefined behavior. It is provided for the core system.


getIndex

int getIndex()
Returns the index of this node. It is such that Network.get(n.getIndex()) returns n. This index can change during a simulation, it is not a fixed id. If you need that, use getID().

See Also:
Network.get(int)

getID

long getID()
Returns the unique ID of the node. It is guaranteed that the ID is unique during the entire simulation, that is, there will be no different Node objects with the same ID in the system during one invocation of the JVM. Preferably nodes should implement hashCode() based on this ID.


clone

java.lang.Object clone()
Clones the node. It is defined as part of the interface to change the access right to public and to get rid of the throws clause.