peersim.vector
Class Getter

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

public class Getter
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 getValue 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
Getter(java.lang.String prefix, java.lang.String protocol, java.lang.String methodn)
          Constructs a Getter class based on the configuration.
 
Method Summary
 java.lang.Number get(int i)
          Gets the given value as a Number.
 java.lang.Number get(Node n)
          Gets the given value as a Number.
 double getDouble(int i)
          Gets the given real value.
 double getDouble(Node n)
          Gets the given real value.
 long getLong(int i)
          Gets the given integer value.
 long getLong(Node n)
          Gets the given integer value.
 java.lang.Class getType()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Getter

public Getter(java.lang.String prefix,
              java.lang.String protocol,
              java.lang.String methodn)
Constructs a Getter 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 getter method. The parameter prefix + "." + protocol is read.
methodn - the configuration parameter name that contains the getter method name. The parameter prefix + "." + methodn is read, with the default value getValue.
Method Detail

getType

public java.lang.Class getType()
Returns:
type of return value of getter method

get

public java.lang.Number get(Node n)
Gets the given value as a Number.

Parameters:
n - The node to get the value on. The protocol is defined by pid.
Returns:
the read value.

getLong

public long getLong(Node n)
Gets the given integer value.

Parameters:
n - The node to get the value on. The protocol is defined by pid.
Returns:
the read value.

getDouble

public double getDouble(Node n)
Gets the given real value.

Parameters:
n - The node to get the value on. The protocol is defined by pid.
Returns:
the read value.

get

public java.lang.Number get(int i)
Gets the given value as a Number.

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

getLong

public long getLong(int i)
Gets the given integer value.

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

getDouble

public double getDouble(int i)
Gets the given real value.

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