public virtual void test_of_collectionCollection_sparse_differentSize() { IList <LocalDate> dates = ImmutableList.of(DATE_2011_01_01, DATE_2011_06_01); IList <double> values = ImmutableList.of(1d); assertThrowsIllegalArg(() => SparseLocalDateDoubleTimeSeries.of(dates, values)); }
//------------------------------------------------------------------------- /// <summary> /// Checks if this time-series is equal to another time-series. /// <para> /// Compares this {@code LocalDateDoubleTimeSeries} with another ensuring /// that the dates and values are the same. /// /// </para> /// </summary> /// <param name="obj"> the object to check, null returns false </param> /// <returns> true if this is equal to the other date </returns> public override bool Equals(object obj) { if (this == obj) { return(true); } if (obj is SparseLocalDateDoubleTimeSeries) { SparseLocalDateDoubleTimeSeries other = (SparseLocalDateDoubleTimeSeries)obj; return(Arrays.Equals(dates_Renamed, other.dates_Renamed) && Arrays.Equals(values_Renamed, other.values_Renamed)); } return(false); }
//------------------------------------------------------------------------- public virtual void coverage() { IList <LocalDate> dates = ImmutableList.of(DATE_2011_01_01, DATE_2011_06_01); IList <double> values = ImmutableList.of(1d, 2d); SparseLocalDateDoubleTimeSeries test = SparseLocalDateDoubleTimeSeries.of(dates, values); coverImmutableBean(test); IList <LocalDate> dates2 = ImmutableList.of(DATE_2011_06_01, DATE_2012_01_01); IList <double> values2 = ImmutableList.of(2d, 3d); SparseLocalDateDoubleTimeSeries test2 = SparseLocalDateDoubleTimeSeries.of(dates2, values2); coverBeanEquals(test, test2); }
//------------------------------------------------------------------------- public virtual void test_immutableViaBeanBuilder() { LocalDate[] dates = new LocalDate[] { DATE_2010_01_01, DATE_2011_01_01, DATE_2012_01_01 }; double[] values = new double[] { 6, 5, 4 }; //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: org.joda.beans.BeanBuilder<? extends LocalDateDoubleTimeSeries> builder = SparseLocalDateDoubleTimeSeries.meta().builder(); BeanBuilder <LocalDateDoubleTimeSeries> builder = SparseLocalDateDoubleTimeSeries.meta().builder(); builder.set("dates", dates); builder.set("values", values); LocalDateDoubleTimeSeries test = builder.build(); dates[0] = DATE_2012_01_01; values[0] = -1; //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: LocalDateDoublePoint[] points = test.ToArray(LocalDateDoublePoint[] ::new); assertEquals(points[0], LocalDateDoublePoint.of(DATE_2010_01_01, 6d)); assertEquals(points[1], LocalDateDoublePoint.of(DATE_2011_01_01, 5d)); assertEquals(points[2], LocalDateDoublePoint.of(DATE_2012_01_01, 4d)); }
private SparseLocalDateDoubleTimeSeries createSparseSeries() { return(SparseLocalDateDoubleTimeSeries.of(entries.Keys, entries.Values)); }