SpreadDoublesCurve extends DoublesCurve { public Set<String> getUnderlyingNames() { final Set<String> result = new HashSet<>(); for (final Curve<Double, Double> curve : _curves) { if (curve instanceof SpreadDoublesCurve) { result.addAll(((SpreadDoublesCurve) curve).getUnderlyingNames()); } else { result.add(curve.getName()); } } return result; } 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 testGetUnderlyingNames() { Set<String> expected = Sets.newHashSet("a", "b"); Set<String> actual = SPREAD1.getUnderlyingNames(); assertEquals(expected.size(), actual.size()); for (final String s : expected) { assertTrue(actual.contains(s)); } expected = Sets.newHashSet("a", "b"); actual = SPREAD2.getUnderlyingNames(); assertEquals(expected.size(), actual.size()); for (final String s : expected) { assertTrue(actual.contains(s)); } expected = Sets.newHashSet("a", "b"); actual = SPREAD2.getUnderlyingNames(); assertEquals(expected.size(), actual.size()); for (final String s : expected) { assertTrue(actual.contains(s)); } }