Search in sources :

Example 1 with Point

use of io.mantisrx.mantis.examples.sinefunction.core.Point in project mantis by Netflix.

the class SinePointGeneratorStage method call.

@Override
public Observable<Point> call(Context context, Observable<Integer> o) {
    final double amplitude = (double) context.getParameters().get(SineFunctionJob.AMPLITUDE);
    final double frequency = (double) context.getParameters().get(SineFunctionJob.FREQUENCY);
    final double phase = (double) context.getParameters().get(SineFunctionJob.PHASE);
    return o.filter(x -> x % 2 == 0).map(x -> new Point(x, amplitude * Math.sin((frequency * x) + phase)));
}
Also used : ScalarComputation(io.mantisrx.runtime.computation.ScalarComputation) Point(io.mantisrx.mantis.examples.sinefunction.core.Point) Context(io.mantisrx.runtime.Context) SineFunctionJob(io.mantisrx.mantis.examples.sinefunction.SineFunctionJob) Observable(rx.Observable) Point(io.mantisrx.mantis.examples.sinefunction.core.Point)

Aggregations

SineFunctionJob (io.mantisrx.mantis.examples.sinefunction.SineFunctionJob)1 Point (io.mantisrx.mantis.examples.sinefunction.core.Point)1 Context (io.mantisrx.runtime.Context)1 ScalarComputation (io.mantisrx.runtime.computation.ScalarComputation)1 Observable (rx.Observable)1