LinearlyScaledFunction implements DoubleFunction<Double> { @Override public Double apply(final double arg0) { double intermediate = this.baseFunction.apply(arg0); return this.mapping.applyAsDouble(intermediate); } LinearlyScaledFunction(final DoubleFunction<Double> baseFunction, final double x1, final double y1, final double x2, final double y2); @Override Double apply(final double arg0); AffineFunction getMapping();  }
@Test public void test() { DoubleFunction<Double> fun = x -> Math.pow(x, 2); LinearlyScaledFunction scaledFun = new LinearlyScaledFunction(fun, 0, 0, 100, 1000); assertEquals(0.0, scaledFun.apply(0), 0.001); assertEquals(1000.0, scaledFun.apply(100), 0.001); for (int i = 0; i < 100; i++) { System.out.println(scaledFun.apply(i)); } }