PolynomialSplineFunction implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction { public boolean isValidPoint(double x) { if (x < knots[0] || x > knots[n]) { return false; } else { return true; } } PolynomialSplineFunction(double knots[], PolynomialFunction polynomials[]); double value(double v); UnivariateFunction derivative(); PolynomialSplineFunction polynomialSplineDerivative(); DerivativeStructure value(final DerivativeStructure t); int getN(); PolynomialFunction[] getPolynomials(); double[] getKnots(); boolean isValidPoint(double x);  }
@Test public void testIsValidPoint() { final PolynomialSplineFunction spline = new PolynomialSplineFunction(knots, polynomials); final double xMin = knots[0]; final double xMax = knots[knots.length - 1]; double x; x = xMin; Assert.assertTrue(spline.isValidPoint(x)); spline.value(x); x = xMax; Assert.assertTrue(spline.isValidPoint(x)); spline.value(x); final double xRange = xMax - xMin; x = xMin + xRange / 3.4; Assert.assertTrue(spline.isValidPoint(x)); spline.value(x); final double small = 1e-8; x = xMin - small; Assert.assertFalse(spline.isValidPoint(x)); try { spline.value(x); Assert.fail("OutOfRangeException expected"); } catch (OutOfRangeException expected) {} }