example.aggregation
Class AverageFunction
java.lang.Object
peersim.vector.SingleValueHolder
example.aggregation.AverageFunction
- All Implemented Interfaces:
- java.lang.Cloneable, CDProtocol, Protocol, SingleValue
public class AverageFunction
- extends SingleValueHolder
- implements CDProtocol
This class provides an implementation for the averaging function in the
aggregation framework. When a pair of nodes interact, their values are
averaged. The class subclasses SingleValueHolder
in
order to provide a consistent access to the averaging variable value.
Note that this class does not override the clone method, because it does
not have any state other than what is inherited from
SingleValueHolder
.
Method Summary |
void |
nextCycle(Node node,
int protocolID)
Using an underlying Linkable protocol choses a neighbor and
performs a variance reduction step. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AverageFunction
public AverageFunction(java.lang.String prefix)
- Creates a new
AverageFunction
protocol
instance.
- Parameters:
prefix
- the component prefix declared in the configuration file.
nextCycle
public void nextCycle(Node node,
int protocolID)
- Using an underlying
Linkable
protocol choses a neighbor and
performs a variance reduction step.
- 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.