CurveShiftFunctionFactory { public static CurveShiftFunction<?> getFunction(final Class<?> clazz) { final CurveShiftFunction<?> f = s_instances.get(clazz); if (f == null) { throw new IllegalArgumentException("Could not get function for " + clazz.getName()); } return f; }  static CurveShiftFunction<?> getFunction(final Class<?> clazz); static DoublesCurve getShiftedCurve(final Curve<Double, Double> curve, final double shift); static DoublesCurve getShiftedCurve(final Curve<Double, Double> curve, final double x, final double shift); static DoublesCurve getShiftedCurve(final Curve<Double, Double> curve, final double[] x, final double[] y); static DoublesCurve getShiftedCurve(final Curve<Double, Double> curve, final double shift, final String newName); static DoublesCurve getShiftedCurve(final Curve<Double, Double> curve, final double x, final double shift, final String newName); static DoublesCurve getShiftedCurve(final Curve<Double, Double> curve, final double[] x, final double[] y, final String newName); static final ConstantCurveShiftFunction CONSTANT; static final FunctionalCurveShiftFunction FUNCTIONAL; static final InterpolatedCurveShiftFunction INTERPOLATED; static final SpreadCurveShiftFunction SPREAD; }
@Test(expectedExceptions = IllegalArgumentException.class) public void testWrongClass() { CurveShiftFunctionFactory.getFunction(String.class); }
@Test public void testFunction() { assertEquals(ConstantCurveShiftFunction.class, CurveShiftFunctionFactory.getFunction(ConstantCurveShiftFunction.class).getClass()); assertEquals(FunctionalCurveShiftFunction.class, CurveShiftFunctionFactory.getFunction(FunctionalCurveShiftFunction.class).getClass()); assertEquals(InterpolatedCurveShiftFunction.class, CurveShiftFunctionFactory.getFunction(InterpolatedCurveShiftFunction.class).getClass()); assertEquals(SpreadCurveShiftFunction.class, CurveShiftFunctionFactory.getFunction(SpreadCurveShiftFunction.class).getClass()); }