SpreadDoublesCurve extends DoublesCurve { @Override public int size() { int size = 0; for (final DoublesCurve underlying : _curves) { if (underlying instanceof InterpolatedDoublesCurve || underlying instanceof NodalDoublesCurve || underlying instanceof SpreadDoublesCurve) { size += underlying.size(); } } if (size != 0) { return size; } throw new UnsupportedOperationException("Size not supported for SpreadDoublesCurve " + getLongName()); } protected  SpreadDoublesCurve();  SpreadDoublesCurve(final CurveSpreadFunction spreadFunction, final DoublesCurve... curves);  SpreadDoublesCurve(final CurveSpreadFunction spreadFunction, final String name, final DoublesCurve... curves); static SpreadDoublesCurve from(final CurveSpreadFunction spreadFunction, final DoublesCurve... curves); static SpreadDoublesCurve from(final CurveSpreadFunction spreadFunction, final String name, final DoublesCurve... curves); Set<String> getUnderlyingNames(); String getLongName(); DoublesCurve[] getUnderlyingCurves(); @Override Double[] getXData(); @Override Double[] getYData(); @Override Double getYValue(final Double x); @Override Double[] getYValueParameterSensitivity(final Double x); @Override double getDyDx(final double x); @Override int size(); @Override boolean equals(final Object obj); @Override int hashCode(); static SpreadDoublesCurve.Meta meta(); @Override SpreadDoublesCurve.Meta metaBean(); final Property<CurveSpreadFunction> spreadFunction(); final Property<Function<Double, Double>> f(); final Property<DoublesCurve[]> curves(); @Override SpreadDoublesCurve clone(); @Override String toString();  }
@Test public void testSize() { assertEquals(INTERPOLATED1.size() + INTERPOLATED2.size(), SPREAD1.size()); assertEquals(INTERPOLATED1.size() + 2 * INTERPOLATED2.size(), SpreadDoublesCurve.from(ADD, new DoublesCurve[] {INTERPOLATED1, SPREAD1}).size()); assertEquals(INTERPOLATED1.size() + INTERPOLATED2.size(), SpreadDoublesCurve.from(ADD, new DoublesCurve[] {CONSTANT1, SPREAD1}).size()); assertEquals(INTERPOLATED1.size() + INTERPOLATED2.size(), SpreadDoublesCurve.from(ADD, new DoublesCurve[] {CONSTANT1, SPREAD1}).size()); }