ConstantCurveShiftFunction implements CurveShiftFunction<ConstantDoublesCurve> { @Override public ConstantDoublesCurve evaluate(final ConstantDoublesCurve curve, final double shift) { Validate.notNull(curve, "curve"); return evaluate(curve, shift, "PARALLEL_SHIFT_" + curve.getName()); }  @Override ConstantDoublesCurve evaluate(final ConstantDoublesCurve curve, final double shift); @Override ConstantDoublesCurve evaluate(final ConstantDoublesCurve curve, final double shift, final String newName); @Override ConstantDoublesCurve evaluate(final ConstantDoublesCurve curve, final double x, final double shift); @Override ConstantDoublesCurve evaluate(final ConstantDoublesCurve curve, final double x, final double shift, final String newName); @Override ConstantDoublesCurve evaluate(final ConstantDoublesCurve curve, final double[] xShift, final double[] yShift); @Override ConstantDoublesCurve evaluate(final ConstantDoublesCurve curve, final double[] xShift, final double[] yShift, final String newName);  }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test1() { F.evaluate(CURVE, 2, 1); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test2() { F.evaluate(CURVE, 2, 1, "A"); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test3() { F.evaluate(CURVE, new double[] {2}, new double[] {1}); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test4() { F.evaluate(CURVE, new double[] {2}, new double[] {1}, "A"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullCurve1() { F.evaluate(null, 1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullCurve2() { F.evaluate(null, 1, "B"); }
@Test public void test() { final double shift = 0.34; ConstantDoublesCurve shifted = F.evaluate(CURVE, shift); assertArrayEquals(shifted.getYData(), new Double[] {Y + shift}); assertEquals(shifted.getName(), "PARALLEL_SHIFT_X"); final String newName = "Y"; shifted = F.evaluate(CURVE, shift, newName); assertArrayEquals(shifted.getYData(), new Double[] {Y + shift}); assertEquals(shifted.getName(), newName); }