FunctionalSurfaceAdditiveShiftFunction implements SurfaceShiftFunction<FunctionalDoublesSurface> { @Override public FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double shift) { Validate.notNull(surface, "surface"); return evaluate(surface, shift, "PARALLEL_SHIFT_" + surface.getName()); }  @Override FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double shift); @Override FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double shift, final String newName); @Override FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double x, final double y, final double shift); @Override FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double x, final double y, final double shift, final String newName); @Override FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double[] xShift, final double[] yShift, final double[] shift); @Override FunctionalDoublesSurface evaluate(final FunctionalDoublesSurface surface, final double[] xShift, final double[] yShift, final double[] shift, final String newName);  }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test1() { SHIFT.evaluate(SURFACE, 2, 1, 1); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test2() { SHIFT.evaluate(SURFACE, 2, 1, 1, "A"); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test3() { SHIFT.evaluate(SURFACE, new double[] {2 }, new double[] {1 }, new double[] {2. }); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test4() { SHIFT.evaluate(SURFACE, new double[] {2 }, new double[] {1 }, new double[] {2. }, "A"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullCurve1() { SHIFT.evaluate(null, 1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullCurve2() { SHIFT.evaluate(null, 1, "B"); }
@Test public void test() { final double shift = 0.34; FunctionalDoublesSurface shifted = SHIFT.evaluate(SURFACE, shift); for (int i = 0; i < 10; i++) { final double x = Math.random(); final double y = Math.random(); assertEquals(shifted.getZValue(x, y), F.evaluate(x, y) + shift, 1e-15); } assertEquals(shifted.getName(), "PARALLEL_SHIFT_A"); final String newName = "Y"; shifted = SHIFT.evaluate(SURFACE, shift, newName); for (int i = 0; i < 10; i++) { final double x = Math.random(); final double y = Math.random(); assertEquals(shifted.getZValue(x, y), F.evaluate(x, y) + shift, 1e-15); } assertEquals(shifted.getName(), newName); }