All Packages Class Hierarchy This Package Previous Next Index
Interface figPac.V2V
- public interface V2V
The interface V2V, which stand for "vector to vector" is used to allow the
programmer to refer to a function (from R^m to R^n) by its name. To do so
the programmer creates a class that implements the interface V2V and programs
the desired function as the method map of that class. The resulting
class can be used as any argument of type V2V of any method. Here is an example.
class Rotate implements V2V {
double angle ;
public Rotate(double angle) {
this.angle = angle ;
}
public double[] map(double[] in) {
double[] out = new double[2] ;
double cos = Math.cos(angle) ;
double sin = Math.sin(angle) ;
out[0] = cos*in[0] + sin*in[1] ;
out[1] = -sin*in[0] + cos*in[1];
return out ;
}
}
-
map(double[])
-
map
public abstract double[] map(double in[])
All Packages Class Hierarchy This Package Previous Next Index