Interpolator1DDoubleQuadraticDataBundle implements Interpolator1DDataBundle, Serializable { @Override public void setYValueAtIndex(final int index, final double y) { ArgumentChecker.notNegative(index, "index"); if (index >= size()) { throw new IllegalArgumentException("Index was greater than number of data points"); } _underlyingData.setYValueAtIndex(index, y); if (_quadratics == null) { _quadratics = getQuadratics(); } final double[] keys = getKeys(); final double[] values = getValues(); final int n = size() - 1; if (index == 0) { _quadratics[0] = getQuadratic(keys, values, 1); return; } else if (index == 1) { _quadratics[0] = getQuadratic(keys, values, 1); _quadratics[1] = getQuadratic(keys, values, 2); return; } else if (index == n) { _quadratics[n - 2] = getQuadratic(keys, values, n - 1); } else if (index == n - 1) { _quadratics[n - 3] = getQuadratic(keys, values, n - 2); _quadratics[n - 2] = getQuadratic(keys, values, n - 1); return; } else { _quadratics[index - 2] = getQuadratic(keys, values, index - 1); _quadratics[index - 1] = getQuadratic(keys, values, index); _quadratics[index] = getQuadratic(keys, values, index + 1); return; } } Interpolator1DDoubleQuadraticDataBundle(final Interpolator1DDataBundle underlyingData); RealPolynomialFunction1D getQuadratic(final int index); RealPolynomialFunction1D getQuadraticFirstDerivative(final int index); @Override boolean containsKey(final Double key); @Override Double firstKey(); @Override Double firstValue(); @Override Double get(final Double key); @Override InterpolationBoundedValues getBoundedValues(final Double key); @Override double[] getKeys(); @Override int getLowerBoundIndex(final Double value); @Override Double getLowerBoundKey(final Double value); @Override double[] getValues(); @Override Double higherKey(final Double key); @Override Double higherValue(final Double key); @Override Double lastKey(); @Override Double lastValue(); @Override int size(); @Override void setYValueAtIndex(final int index, final double y); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testSetNegativeIndex() { DATA.setYValueAtIndex(-2, 3); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testSetHighIndex() { DATA.setYValueAtIndex(100, 4); }