20 import java.util.Vector;
22 import ca.uqac.lif.cep.functions.UnaryFunction;
28 @SuppressWarnings(
"rawtypes")
29 public class
Modulus extends UnaryFunction<Vector,Float>
41 super(Vector.class, Float.class);
45 public Float getValue(Vector v)
47 float x = (Float) v.get(0);
48 float y = (Float) v.get(1);
49 return (
float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
53 public String toString()
Modulus()
Creates a new instance of the function.
Function that calculates the modulus of a two dimensional vector.