DoublesCurveInterpolatedAnchor extends InterpolatedDoublesCurve { public static DoublesCurveInterpolatedAnchor from(double[] xData, double[] yData, double anchor, Interpolator1D interpolator, String name) { ArgumentChecker.notNull(xData, "X data"); int xLength = xData.length; ArgumentChecker.notNull(yData, "Y data"); ArgumentChecker.isTrue(xLength == yData.length, "Data of incorrect length."); double[] xExtended = new double[xLength + 1]; double[] yExtended = new double[xLength + 1]; System.arraycopy(xData, 0, xExtended, 0, xLength); xExtended[xLength] = anchor; System.arraycopy(yData, 0, yExtended, 0, xLength); ParallelArrayBinarySort.parallelBinarySort(xExtended, yExtended); int anchorIndex = ArrayUtils.indexOf(xExtended, anchor); return new DoublesCurveInterpolatedAnchor(xExtended, yExtended, anchorIndex, interpolator, name); } private  DoublesCurveInterpolatedAnchor(double[] xData, double[] yData, int anchorIndex, Interpolator1D interpolator, String name); protected  DoublesCurveInterpolatedAnchor(); static DoublesCurveInterpolatedAnchor from(double[] xData, double[] yData, double anchor, Interpolator1D interpolator, String name); static DoublesCurveInterpolatedAnchor from(double[] xData, double[] yData, double anchor, double anchorValue, Interpolator1D interpolator, String name); int getAnchorIndex(); @Override int size(); @Override Double[] getYValueParameterSensitivity(Double x); @Override boolean equals(Object obj); @Override int hashCode(); static DoublesCurveInterpolatedAnchor.Meta meta(); @Override DoublesCurveInterpolatedAnchor.Meta metaBean(); Property<Integer> anchorIndex(); @Override DoublesCurveInterpolatedAnchor clone(); @Override String toString();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullNode() { DoublesCurveInterpolatedAnchor.from(null, VALUE, ANCHOR, LINEAR, CURVE_NAME); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullValue() { DoublesCurveInterpolatedAnchor.from(NODE, null, ANCHOR, LINEAR, CURVE_NAME); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullInterpolator() { DoublesCurveInterpolatedAnchor.from(NODE, VALUE, ANCHOR, null, CURVE_NAME); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullName() { DoublesCurveInterpolatedAnchor.from(NODE, VALUE, ANCHOR, LINEAR, null); }
@Test public void compareInterpolation() { InterpolatedDoublesCurve curveInterpolated = InterpolatedDoublesCurve.from(NODE_WITH_ANCHOR, VALUE_WITH_ANCHOR, LINEAR); int nbPts = 10; for (int looppt = 0; looppt <= nbPts; looppt++) { double x = NODE[0] + looppt * (NODE[NODE.length - 1] - NODE[0]) / nbPts; assertEquals("DoublesCurveInterpolatedAnchor: value", curveInterpolated.getYValue(x), CURVE.getYValue(x), TOLERANCE); } }