example.edaggregation
Class AverageED

java.lang.Object
  extended by peersim.vector.SingleValueHolder
      extended by example.edaggregation.AverageED
All Implemented Interfaces:
java.lang.Cloneable, CDProtocol, Protocol, EDProtocol<example.edaggregation.AverageMessage>, SingleValue

public class AverageED
extends SingleValueHolder
implements CDProtocol, EDProtocol<example.edaggregation.AverageMessage>

Event driven version of epidemic averaging.


Field Summary
 
Fields inherited from class peersim.vector.SingleValueHolder
value
 
Constructor Summary
AverageED(java.lang.String prefix)
           
 
Method Summary
 void nextCycle(Node node, int pid)
          This is the standard method the define periodic activity.
 void processEvent(Node node, int pid, example.edaggregation.AverageMessage aem)
          This is the standard method to define to process incoming messages.
 
Methods inherited from class peersim.vector.SingleValueHolder
clone, getValue, setValue, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface peersim.core.Protocol
clone
 

Constructor Detail

AverageED

public AverageED(java.lang.String prefix)
Parameters:
prefix - string prefix for config properties
Method Detail

nextCycle

public void nextCycle(Node node,
                      int pid)
This is the standard method the define periodic activity. The frequency of execution of this method is defined by a CDScheduler component in the configuration.

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

processEvent

public void processEvent(Node node,
                         int pid,
                         example.edaggregation.AverageMessage aem)
This is the standard method to define to process incoming messages.

Specified by:
processEvent in interface EDProtocol<example.edaggregation.AverageMessage>
Parameters:
node - the local node
pid - the identifier of this protocol
aem - the delivered event