All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface figPac.S2S

public interface S2S
The interface S2S, which stand for "scalar to scalar" is used to allow the programmer to refer to a function (from R to R) by its name. To do so the programmer creates a class that implements the interface S2S and programs the desired function as the method map of that class. The resulting class can be used as any argument of type S2S of any method. Here is an example.
class Oscillate implements S2S {
double freq, phase, amplitude ;
public Oscillate(double amplitude, double freq, double phase) {
this.freq = freq ;
this.phase = phase ;
this.amplitude = amplitude ;
}
public double map(double t) {
return amplitude*Math.sin(freq*t-phase) ;
}
}


Method Index

 o map(double)

Methods

 o map
 public abstract double map(double in)

All Packages  Class Hierarchy  This Package  Previous  Next  Index