LogLinearInterpolator1D extends Interpolator1D { @Override public Double interpolate(final Interpolator1DDataBundle model, final Double value) { Validate.notNull(value, "value"); Validate.notNull(model, "data bundle"); final InterpolationBoundedValues boundedValues = model.getBoundedValues(value); final Double x1 = boundedValues.getLowerBoundKey(); final Double y1 = boundedValues.getLowerBoundValue(); if (model.getLowerBoundIndex(value) == model.size() - 1) { return y1; } final Double x2 = boundedValues.getHigherBoundKey(); final Double y2 = boundedValues.getHigherBoundValue(); return Math.pow(y2 / y1, (value - x1) / (x2 - x1)) * y1; }  @Override Double interpolate(final Interpolator1DDataBundle model, final Double value); @Override double firstDerivative(final Interpolator1DDataBundle model, final Double value); @Override Interpolator1DDataBundle getDataBundle(final double[] x, final double[] y); @Override Interpolator1DDataBundle getDataBundleFromSortedArrays(final double[] x, final double[] y); @Override double[] getNodeSensitivitiesForValue(Interpolator1DDataBundle data, Double value);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullDataBundle() { INTERPOLATOR.interpolate(null, 3.4); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullData() { INTERPOLATOR.interpolate(MODEL, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testLowValue() { INTERPOLATOR.interpolate(MODEL, -2.); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testHighValue() { INTERPOLATOR.interpolate(MODEL, 12.); }
@Test public void test() { assertEquals(Math.log(INTERPOLATOR.interpolate(MODEL, 3.4)), LINEAR.interpolate(TRANSFORMED_MODEL, 3.4), EPS); }