NodalDoublesSurface extends DoublesSurface { @Override public Double getZValue(final Double x, final Double y) { Validate.notNull(x, "x"); Validate.notNull(y, "y"); final double[] xArray = getXDataAsPrimitive(); final double[] yArray = getYDataAsPrimitive(); final int n = size(); for (int i = 0; i < n; i++) { if (Double.doubleToLongBits(xArray[i]) == Double.doubleToLongBits(x)) { if (Double.doubleToLongBits(yArray[i]) == Double.doubleToLongBits(y)) { return getZDataAsPrimitive()[i]; } } } throw new IllegalArgumentException("No x-y data in surface for (" + x + ", " + y + ")"); } NodalDoublesSurface(final double[] xData, final double[] yData, final double[] zData);  NodalDoublesSurface(final Double[] xData, final Double[] yData, final Double[] zData);  NodalDoublesSurface(final List<Double> xData, final List<Double> yData, final List<Double> zData);  NodalDoublesSurface(final DoublesPair[] xyData, final double[] zData);  NodalDoublesSurface(final DoublesPair[] xyData, final Double[] zData);  NodalDoublesSurface(final List<DoublesPair> xyData, final List<Double> zData);  NodalDoublesSurface(final Map<DoublesPair, Double> xyzData);  NodalDoublesSurface(final List<Triple<Double, Double, Double>> xyzData);  NodalDoublesSurface(final double[] xData, final double[] yData, final double[] zData, final String name);  NodalDoublesSurface(final Double[] xData, final Double[] yData, final Double[] zData, final String name);  NodalDoublesSurface(final List<Double> xData, final List<Double> yData, final List<Double> zData, final String name);  NodalDoublesSurface(final DoublesPair[] xyData, final double[] zData, final String name);  NodalDoublesSurface(final DoublesPair[] xyData, final Double[] zData, final String name);  NodalDoublesSurface(final List<DoublesPair> xyData, final List<Double> zData, final String name);  NodalDoublesSurface(final Map<DoublesPair, Double> xyzData, final String name);  NodalDoublesSurface(final List<Triple<Double, Double, Double>> xyzData, final String name); static NodalDoublesSurface from(final double[] xData, final double[] yData, final double[] zData); static NodalDoublesSurface from(final Double[] xData, final Double[] yData, final Double[] zData); static NodalDoublesSurface from(final List<Double> xData, final List<Double> yData, final List<Double> zData); static NodalDoublesSurface from(final DoublesPair[] xyData, final Double[] zData); static NodalDoublesSurface from(final DoublesPair[] xyData, final double[] zData); static NodalDoublesSurface from(final List<DoublesPair> xyData, final List<Double> zData); static NodalDoublesSurface from(final Map<DoublesPair, Double> data); static NodalDoublesSurface from(final List<Triple<Double, Double, Double>> xyzData); static NodalDoublesSurface from(final double[] xData, final double[] yData, final double[] zData, final String name); static NodalDoublesSurface from(final Double[] xData, final Double[] yData, final Double[] zData, final String name); static NodalDoublesSurface from(final List<Double> xData, final List<Double> yData, final List<Double> zData, final String name); static NodalDoublesSurface from(final DoublesPair[] xyData, final double[] zData, final String name); static NodalDoublesSurface from(final DoublesPair[] xyData, final Double[] zData, final String name); static NodalDoublesSurface from(final List<DoublesPair> xyData, final List<Double> zData, final String name); static NodalDoublesSurface from(final Map<DoublesPair, Double> xyzData, final String name); static NodalDoublesSurface from(final List<Triple<Double, Double, Double>> xyzData, final String name); @Override Double getZValue(final Double x, final Double y); @Override Double getZValue(final Pair<Double, Double> xy);  }
@Test public void testGetZValue() { final double eps = 1e-15; assertEquals(SURFACE.getZValue(0., 1.), 0., eps); assertEquals(SURFACE.getZValue(4., 0.), 16., eps); assertEquals(SURFACE.getZValue(1., 1.), 4., eps); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullX1() { SURFACE.getZValue(null, 2.); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullY1() { SURFACE.getZValue(1., null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNull() { SURFACE.getZValue(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNonNodalX1() { SURFACE.getZValue(1.1, 2.); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNonNodalY1() { SURFACE.getZValue(1., 3.); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNonNodalX2() { SURFACE.getZValue(DoublesPair.of(1.1, 2.)); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNonNodalY2() { SURFACE.getZValue(DoublesPair.of(1., 3.4)); }