ConstantSurfaceMultiplicativeShiftFunction implements SurfaceShiftFunction<ConstantDoublesSurface> { @Override public ConstantDoublesSurface evaluate(final ConstantDoublesSurface surface, final double percentage) { Validate.notNull(surface, "surface"); return evaluate(surface, percentage, "CONSTANT_MULTIPLIER_" + surface.getName()); }  @Override ConstantDoublesSurface evaluate(final ConstantDoublesSurface surface, final double percentage); @Override ConstantDoublesSurface evaluate(final ConstantDoublesSurface surface, final double percentage, final String newName); @Override ConstantDoublesSurface evaluate(final ConstantDoublesSurface surface, final double x, final double y, final double shift); @Override ConstantDoublesSurface evaluate(final ConstantDoublesSurface surface, final double x, final double y, final double percentage, final String newName); @Override ConstantDoublesSurface evaluate(final ConstantDoublesSurface surface, final double[] xShift, final double[] yShift, final double[] percentage); @Override ConstantDoublesSurface evaluate(final ConstantDoublesSurface surface, final double[] xShift, final double[] yShift, final double[] percentage, final String newName);  }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test1() { F.evaluate(SURFACE, 2, 1, 1); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test2() { F.evaluate(SURFACE, 2, 1, 1, "A"); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test3() { F.evaluate(SURFACE, new double[] {2}, new double[] {1}, new double[] {3}); }
@Test(expectedExceptions = UnsupportedOperationException.class) public void test4() { F.evaluate(SURFACE, new double[] {2}, new double[] {1}, new double[] {3.}, "A"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullSurface1() { F.evaluate(null, 1); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullSurface2() { F.evaluate(null, 1, "B"); }
@Test public void test() { final double shift = 0.34; ConstantDoublesSurface shifted = F.evaluate(SURFACE, shift); assertArrayEquals(shifted.getZData(), new Double[] {Z * (1 + shift)}); assertEquals(shifted.getName(), "CONSTANT_MULTIPLIER_X"); final String newName = "Y"; shifted = F.evaluate(SURFACE, shift, newName); assertArrayEquals(shifted.getZData(), new Double[] {Z * (1 + shift)}); assertEquals(shifted.getName(), newName); }