DoubleTimeSeriesStatisticsCalculator implements Function<DoubleTimeSeries<?>, Double> { @Override public Double evaluate(final DoubleTimeSeries<?>... x) { Validate.notNull(x, "x"); Validate.isTrue(x.length > 0); ArgumentChecker.noNulls(x, "x"); final int n = x.length; final double[][] arrays = new double[n][]; for (int i = 0; i < n; i++) { arrays[i] = x[i].valuesArrayFast(); } return _statistic.evaluate(arrays); } DoubleTimeSeriesStatisticsCalculator(final Function<double[], Double> statistic); @Override Double evaluate(final DoubleTimeSeries<?>... x);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullTS() { CALC.evaluate((DoubleTimeSeries<?>) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptyTS() { CALC.evaluate(ImmutableInstantDoubleTimeSeries.EMPTY_SERIES); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testNullTSInArray() { CALC.evaluate(TS, null, TS); }
@Test public void test() { assertEquals(CALC.evaluate(TS), MEAN.evaluate(TS.valuesArrayFast()), 1e-15); }