DoublesScheduleGenerator { public static double[] getIntegrationsPoints(final double start, final double end, final ISDACompliantYieldCurve yieldCurve, final ISDACompliantCreditCurve creditCurve) { return getIntegrationsPoints(start, end, yieldCurve.getKnotTimes(), creditCurve.getKnotTimes()); }  static double[] getIntegrationsPoints(final double start, final double end, final ISDACompliantYieldCurve yieldCurve, final ISDACompliantCreditCurve creditCurve); static double[] getIntegrationsPoints(final double start, final double end, final double[] setA, final double[] setB); static double[] combineSets(final double[] set1, final double[] set2); static double[] truncateSetInclusive(final double lower, final double upper, final double[] set); static double[] truncateSetExclusive(final double lower, final double upper, final double[] set); static double[] leftTruncate(final double lower, final double[] set);  }
@Test public void getIntegrationsPointsTest() { final double start = 0.1; final double end = 2.; final double[] setA0 = new double[] {0.5, 0.9, 1.4 }; final double[] setB0 = new double[] {0.3, 0.4, 1.5, 1.6 }; final double[] exp0 = new double[] {0.1, 0.3, 0.4, 0.5, 0.9, 1.4, 1.5, 1.6, 2. }; final double[] res0 = DoublesScheduleGenerator.getIntegrationsPoints(start, end, setA0, setB0); assertTrue(equalArrays(exp0, res0)); final double[] setA1 = new double[] {0.5, 0.9, 1.4 }; final double[] setB1 = new double[] {0.3, 0.4, 0.5, 1.5, 1.6 }; final double[] exp1 = new double[] {0.1, 0.3, 0.4, 0.5, 0.9, 1.4, 1.5, 1.6, 2. }; final double[] res1 = DoublesScheduleGenerator.getIntegrationsPoints(start, end, setA1, setB1); assertTrue(equalArrays(exp1, res1)); final double[] setA2 = new double[] {0.2, 0.9, 1.4 }; final double[] setB2 = new double[] {0.3, 0.4, 0.5, 1.5, 2. - 1.e-3 }; final double[] exp2 = new double[] {0.1, 0.2, 0.3, 0.4, 0.5, 0.9, 1.4, 1.5, 2. }; final double[] res2 = DoublesScheduleGenerator.getIntegrationsPoints(start, end, setA2, setB2); assertTrue(equalArrays(exp2, res2)); final double[] setA3 = new double[] {0.05, 0.07 }; final double[] setB3 = new double[] {0.03, 0.04 }; final double[] exp3 = new double[] {0.1, 2. }; final double[] res3 = DoublesScheduleGenerator.getIntegrationsPoints(start, end, setA3, setB3); assertTrue(equalArrays(exp3, res3)); final double[] setA4 = new double[] {2.2, 2.7 }; final double[] setB4 = new double[] {2.3, 2.4 }; final double[] exp4 = new double[] {0.1, 2. }; final double[] res4 = DoublesScheduleGenerator.getIntegrationsPoints(start, end, setA4, setB4); assertTrue(equalArrays(exp4, res4)); final double[] setA5 = new double[] {-0.5, 0., 1.2 }; final double[] setB5 = new double[] {-0.2, -0., 1.2 }; final double[] exp5 = new double[] {-0.3, -0.2, 0., 1.2, 2. }; final double[] res5 = DoublesScheduleGenerator.getIntegrationsPoints(-0.3, end, setA5, setB5); assertTrue(equalArrays(exp5, res5)); }