peersim.vector
Class VectCopy

java.lang.Object
  extended by peersim.vector.VectControl
      extended by peersim.vector.VectCopy
All Implemented Interfaces:
Control, NodeInitializer

public class VectCopy
extends VectControl
implements NodeInitializer

Sets values in a protocol vector by copying the values of another protocol vector. The source is defined by "source", and getter method "getter".

This dynamics class can copy any primitive field in the source protocol to any primitive field in the destination protocol, provided that the former field is associated with a getter method, while the latter is associated with a setter method.

See Also:
VectControl, peersim.vector

Parameter Summary
source
          The identifier of the protocol to be copied.
 
Parameters inherited from class peersim.vector.VectControl
protocol, setter, getter
 
Field Summary
 
Fields inherited from class peersim.vector.VectControl
getter, setter
 
Constructor Summary
VectCopy(java.lang.String prefix)
          Standard constructor that reads the configuration parameters.
 
Method Summary
 boolean execute()
          Sets values in a protocol vector by copying the values of another protocol vector.
 void initialize(Node n)
          Sets the value by copying the value of another protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

source

The identifier of the protocol to be copied. The vector values are copied from this vector.

Constructor Detail

VectCopy

public VectCopy(java.lang.String prefix)
Standard constructor that reads the configuration parameters. Invoked by the simulation engine.

Parameters:
prefix - the configuration prefix for this class
Method Detail

execute

public boolean execute()
Sets values in a protocol vector by copying the values of another protocol vector. The source is defined by "source", and getter method "getter". Single nodes may avoid to be considered in the copy by throwing an UnsupportedOperationException in the getter method; if so, the setter method will not be invoked on the corresponding element of the vector protocol.

Specified by:
execute in interface Control
Returns:
always false

initialize

public void initialize(Node n)
Sets the value by copying the value of another protocol. The source is defined by "source", and getter method "getter".

Specified by:
initialize in interface NodeInitializer
Parameters:
n - the node to initialize