peersim.cdsim
Class DaemonProtocol

java.lang.Object
  extended by peersim.cdsim.DaemonProtocol
All Implemented Interfaces:
java.lang.Cloneable, CDProtocol, Protocol

public class DaemonProtocol
extends java.lang.Object
implements CDProtocol

A protocol that is not really a protocol, but a trick to carry out all kinds of tasks during the simulation. Many users will probably not need it, but it is a nice way to e.g. run controls at any time, not only between cycles.


Parameter Summary
control
          This is the prefix for network dynamism managers.
cstep
          The controls will be run according to this frequency.
 
Constructor Summary
DaemonProtocol(java.lang.String s)
           
 
Method Summary
 java.lang.Object clone()
          Returns a clone of the protocol.
 void nextCycle(Node node, int protocolID)
          Runs the configured controls if CDState.getCycleT() % "cstep"=0.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

control

This is the prefix for network dynamism managers.


cstep

The controls will be run according to this frequency. It is interpreted within a cycle, in terms of cycle time (CDState.getCycleT()). The first cycletime is 0. Defaults to 1.

Constructor Detail

DaemonProtocol

public DaemonProtocol(java.lang.String s)
Method Detail

clone

public java.lang.Object clone()
Description copied from interface: Protocol
Returns a clone of the protocol. It is important to pay attention to implement this carefully because in peersim all nodes are generated by cloning except a prototype node. That is, the constructor of protocols is used only to construct the prototype. Initialization can be done via Controls.

Specified by:
clone in interface Protocol
Overrides:
clone in class java.lang.Object

nextCycle

public void nextCycle(Node node,
                      int protocolID)
Runs the configured controls if CDState.getCycleT() % "cstep"=0.

Specified by:
nextCycle in interface CDProtocol
Parameters:
node - the node on which this component is run
protocolID - the id of this protocol in the protocol array