ImmutableInstantDoubleTimeSeries extends AbstractInstantDoubleTimeSeries implements InstantDoubleTimeSeries, Serializable { public static ImmutableInstantDoubleTimeSeries of(Instant instant, double value) { Objects.requireNonNull(instant, "instant"); long[] timesArray = new long[] {InstantToLongConverter.convertToLong(instant)}; double[] valuesArray = new double[] {value}; return new ImmutableInstantDoubleTimeSeries(timesArray, valuesArray); } ImmutableInstantDoubleTimeSeries(long[] nanos, double[] values); static InstantDoubleTimeSeriesBuilder builder(); static ImmutableInstantDoubleTimeSeries of(Instant instant, double value); static ImmutableInstantDoubleTimeSeries of(Instant[] instants, Double[] values); static ImmutableInstantDoubleTimeSeries of(Instant[] instants, double[] values); static ImmutableInstantDoubleTimeSeries of(long[] instants, double[] values); static ImmutableInstantDoubleTimeSeries of(Collection<Instant> instants, Collection<Double> values); static ImmutableInstantDoubleTimeSeries of(PreciseDoubleTimeSeries<?> timeSeries); static ImmutableInstantDoubleTimeSeries from(DoubleTimeSeries<Instant> timeSeries); @Override int size(); @Override boolean containsTime(long instant); @Override Double getValue(long instant); @Override long getTimeAtIndexFast(int index); @Override double getValueAtIndexFast(int index); @Override long getEarliestTimeFast(); @Override double getEarliestValueFast(); @Override long getLatestTimeFast(); @Override double getLatestValueFast(); @Override long[] timesArrayFast(); @Override double[] valuesArrayFast(); @Override InstantDoubleTimeSeries subSeriesFast(long startTime, boolean includeStart, long endTime, boolean includeEnd); @Override InstantDoubleTimeSeries head(int numItems); @Override InstantDoubleTimeSeries tail(int numItems); @Override ImmutableInstantDoubleTimeSeries newInstance(Instant[] instants, Double[] values); @Override InstantDoubleTimeSeries operate(UnaryOperator operator); @Override InstantDoubleTimeSeries operate(double other, BinaryOperator operator); @Override InstantDoubleTimeSeriesBuilder toBuilder(); static final ImmutableInstantDoubleTimeSeries EMPTY_SERIES; }
@Test(expectedExceptions = NullPointerException.class) public void test_of_Instant_double_null() { ImmutableInstantDoubleTimeSeries.of((Instant) null, 2.0); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_of_InstantArray_DoubleArray_wrongOrder() { Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333), Instant.ofEpochSecond(1111)}; Double[] inValues = new Double[] {2.0, 3.0, 1.0}; ImmutableInstantDoubleTimeSeries.of(inDates, inValues); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_of_InstantArray_DoubleArray_mismatchedArrays() { Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222)}; Double[] inValues = new Double[] {2.0, 3.0}; ImmutableInstantDoubleTimeSeries.of(inDates, inValues); }
@Test(expectedExceptions = NullPointerException.class) public void test_of_InstantArray_DoubleArray_nullDates() { Double[] inValues = new Double[] {2.0, 3.0, 1.0}; ImmutableInstantDoubleTimeSeries.of((Instant[]) null, inValues); }
@Test(expectedExceptions = NullPointerException.class) public void test_of_InstantArray_DoubleArray_nullValues() { Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333), Instant.ofEpochSecond(1111)}; ImmutableInstantDoubleTimeSeries.of(inDates, (Double[]) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_of_InstantArray_doubleArray_wrongOrder() { Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333), Instant.ofEpochSecond(1111)}; double[] inValues = new double[] {2.0, 3.0, 1.0}; ImmutableInstantDoubleTimeSeries.of(inDates, inValues); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_of_InstantArray_doubleArray_mismatchedArrays() { Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222)}; double[] inValues = new double[] {2.0, 3.0}; ImmutableInstantDoubleTimeSeries.of(inDates, inValues); }
@Test(expectedExceptions = NullPointerException.class) public void test_of_InstantArray_doubleArray_nullDates() { double[] inValues = new double[] {2.0, 3.0, 1.0}; ImmutableInstantDoubleTimeSeries.of((Instant[]) null, inValues); }
@Test(expectedExceptions = NullPointerException.class) public void test_of_InstantArray_doubleArray_nullValues() { Instant[] inDates = new Instant[] {Instant.ofEpochSecond(2222), Instant.ofEpochSecond(3333), Instant.ofEpochSecond(1111)}; ImmutableInstantDoubleTimeSeries.of(inDates, (double[]) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_of_longArray_doubleArray_wrongOrder() { long[] inDates = new long[] {2222_000_000_000L, 3333_000_000_000L, 1111_000_000_000L}; double[] inValues = new double[] {2.0, 3.0, 1.0}; ImmutableInstantDoubleTimeSeries.of(inDates, inValues); }
@Test(expectedExceptions = IllegalArgumentException.class) public void test_of_longArray_doubleArray_mismatchedArrays() { long[] inDates = new long[] {2222_000_000_000L}; double[] inValues = new double[] {2.0, 3.0}; ImmutableInstantDoubleTimeSeries.of(inDates, inValues); }
@Test(expectedExceptions = NullPointerException.class) public void test_of_longArray_doubleArray_nullDates() { double[] inValues = new double[] {2.0, 3.0, 1.0}; ImmutableInstantDoubleTimeSeries.of((long[]) null, inValues); }
@Test(expectedExceptions = NullPointerException.class) public void test_of_longArray_doubleArray_nullValues() { long[] inDates = new long[] {2222_000_000_000L, 3333_000_000_000L}; ImmutableInstantDoubleTimeSeries.of(inDates, (double[]) null); }