peersim.vector
Class Setter

java.lang.Object
  extended by peersim.vector.Setter

public class Setter
extends java.lang.Object

Vectors can be written through this class. Typically Control classes use this to manipulate vectors.

The method to be used is specified at construction time. For backward compatibility, if no method is specified, the method setValue is used. In this way, protocols implementing the SingleValue interface can be manipulated using the old configuration syntax (i.e., without specifying the method).

Please refer to package peersim.vector for a detailed description of the concept of protocol vector and the role of getters and setters.


Constructor Summary
Setter(java.lang.String prefix, java.lang.String protocol, java.lang.String methodn)
          Constructs a Setter class based on the configuration.
 
Method Summary
 java.lang.Class getType()
           
 boolean isInteger()
           
 void set(int i, double val)
          Sets the given real value.
 void set(int i, long val)
          Sets the given integer value.
 void set(Node n, double val)
          Sets the given real value.
 void set(Node n, long val)
          Sets the given integer value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Setter

public Setter(java.lang.String prefix,
              java.lang.String protocol,
              java.lang.String methodn)
Constructs a Setter class based on the configuration. Note that the actual initialization is delayed until the first access to the class, so that if a class is not used, no unnecessary error messages and exceptions are generated.

Parameters:
prefix - the configuration prefix to use when reading the configuration
protocol - the configuration parameter name that contains the protocol we want to manipulate using a setter method. The parameter prefix + "." + protocol is read.
methodn - the configuration parameter name that contains the setter method name. The parameter prefix + "." + methodn is read, with the default value setValue.
Method Detail

getType

public java.lang.Class getType()
Returns:
type of parameter of setter method

isInteger

public boolean isInteger()
Returns:
true if the setter type is long or int

set

public void set(Node n,
                long val)
Sets the given integer value.

Parameters:
n - The node to set the value on. The protocol is defined by pid.
val - the value to set.

set

public void set(Node n,
                double val)
Sets the given real value.

Parameters:
n - The node to set the value on. The protocol is defined by pid.
val - the value to set.

set

public void set(int i,
                long val)
Sets the given integer value.

Parameters:
i - The index of the node to set the value on in the network. The protocol is defined by pid.
val - the value to set.

set

public void set(int i,
                double val)
Sets the given real value.

Parameters:
i - The index of the node to set the value on in the network. The protocol is defined by pid.
val - the value to set.