peersim.vector
Class VectAngle

java.lang.Object
  extended by peersim.vector.VectAngle
All Implemented Interfaces:
Control

public class VectAngle
extends java.lang.Object
implements Control

Observes the cosine angle between two vectors. The number which is output is the inner product divided by the product of the length of the vectors. All values are converted to double before processing.

This observer class can observe any protocol field containing a primitive value, provided that the field is associated with a getter method that reads it. The methods to be used are specified through parameter "getter1" and "getter2".

Please refer to package peersim.vector for a detailed description of this mechanism.


Parameter Summary
protocol1
          The first protocol to be observed.
protocol2
          The second protocol to be observed.
getter1
          The getter method used to obtain the values of the first protocol.
getter2
          The getter method used to obtain the values of the second protocol.
 
Constructor Summary
VectAngle(java.lang.String prefix)
          Standard constructor that reads the configuration parameters.
 
Method Summary
 boolean execute()
          Observes the cosine angle between two vectors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

protocol1

The first protocol to be observed.


protocol2

The second protocol to be observed.


getter1

The getter method used to obtain the values of the first protocol. Defaults to getValue (for backward compatibility with previous implementation of this class, that were based on the SingleValue interface). Refer to the vector package description for more information about getters and setters.


getter2

The getter method used to obtain the values of the second protocol. Defaults to getValue (for backward compatibility with previous implementation of this class, that were based on the SingleValue interface). Refer to the vector package description for more information about getters and setters.

Constructor Detail

VectAngle

public VectAngle(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()
Observes the cosine angle between two vectors. The printed values are: cosine, Eucledian norm of vect 1, Eucledian norm of vector 2, angle in radians.

Specified by:
execute in interface Control
Returns:
always false