peersim.dynamics
Class StarNI

java.lang.Object
  extended by peersim.dynamics.StarNI
All Implemented Interfaces:
NodeInitializer

public class StarNI
extends java.lang.Object
implements NodeInitializer

Initializes a node's neighbor list with a fixed center.


Parameter Summary
protocol
          The protocol to operate on.
pack
          If this config property is defined, method Linkable.pack() is invoked on the specified protocol at the end of the wiring phase.
 
Field Summary
protected  Node center
          Used as center: nodes will link to this node.
protected  boolean pack
          If true, method pack() is invoked on the initialized protocol
protected  int pid
          The protocol we want to wire
 
Constructor Summary
StarNI(java.lang.String prefix)
           
 
Method Summary
 void initialize(Node n)
          Adds a link to a fixed node, the center.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

protocol

The protocol to operate on.


pack

If this config property is defined, method Linkable.pack() is invoked on the specified protocol at the end of the wiring phase. Default to false.

Field Detail

pid

protected final int pid
The protocol we want to wire


pack

protected final boolean pack
If true, method pack() is invoked on the initialized protocol


center

protected Node center
Used as center: nodes will link to this node.

Constructor Detail

StarNI

public StarNI(java.lang.String prefix)
Method Detail

initialize

public void initialize(Node n)
Adds a link to a fixed node, the center. This fixed node remains the same throughout consecutive calls to this method. If the center fails in the meantime, a new one is chosen so care should be taken. The center is the first node that is not down (starting from node 0, 1, etc) at the time of the first call to the function. When a new center needs to be chosen (the current one is down), the new center is again the first one which is up. If no nodes are up, the node with the last index is set as center, and selection of a new center is always attempted when this method is called again.

Specified by:
initialize in interface NodeInitializer