AdaptiveCompositeIntegrator1D extends Integrator1D<Double, Double> { @Override public Double integrate(final Function1D<Double, Double> f, final Double lower, final Double upper) { Validate.notNull(f, "f"); Validate.notNull(lower, "lower bound"); Validate.notNull(upper, "upper bound"); try { if (lower < upper) { return integration(f, lower, upper); } s_logger.info("Upper bound was less than lower bound; swapping bounds and negating result"); return -integration(f, upper, lower); } catch (final Exception e) { throw new OpenGammaRuntimeException("function evaluation returned NaN or Inf"); } } AdaptiveCompositeIntegrator1D(final Integrator1D<Double, Double> integrator);  AdaptiveCompositeIntegrator1D(final Integrator1D<Double, Double> integrator, final double gain, final double tol); @Override Double integrate(final Function1D<Double, Double> f, final Double lower, final Double upper); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void sampleDataTest() { final Integrator1D<Double, Double> localInt = new AdaptiveCompositeIntegrator1D(new SimpsonIntegrator1D(), 10., 1.e-4); assertEquals(-1.426025, localInt.integrate(sampleFunc(), 1., 3.), 1.e-6); }