/// <summary> /// Puts the contents of the specified builder into this builder. /// <para> /// The points are added one by one. /// If a date is duplicated it will overwrite an earlier entry. /// /// </para> /// </summary> /// <param name="other"> the other builder </param> /// <returns> this builder </returns> public LocalDateDoubleTimeSeriesBuilder putAll(LocalDateDoubleTimeSeriesBuilder other) { ArgChecker.notNull(other, "other"); //JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'putAll' method: entries.putAll(other.entries); containsWeekends = containsWeekends || other.containsWeekends; return(this); }
public virtual void test_merge_point() { LocalDateDoubleTimeSeriesBuilder test = LocalDateDoubleTimeSeries.builder(); test.put(date(2013, 1, 1), 2d); test.merge(LocalDateDoublePoint.of(date(2013, 1, 1), 3d), double?.sum); assertEquals(test.get(date(2013, 1, 1)), double?.of(5d)); }
//------------------------------------------------------------------------- public virtual void test_get() { LocalDateDoubleTimeSeriesBuilder test = LocalDateDoubleTimeSeries.builder().put(date(2014, 1, 1), 14).put(date(2012, 1, 1), 12).put(date(2013, 1, 1), 13); assertEquals(test.get(date(2012, 1, 1)), double?.of(12d)); assertEquals(test.get(date(2013, 1, 1)), double?.of(13d)); assertEquals(test.get(date(2014, 1, 1)), double?.of(14d)); assertEquals(test.get(date(2015, 1, 1)), double?.empty()); }
//------------------------------------------------------------------------- public virtual void test_putAll_collections() { ICollection <LocalDate> dates = Arrays.asList(date(2013, 1, 1), date(2014, 1, 1)); ICollection <double> values = Doubles.asList(2d, 3d); LocalDateDoubleTimeSeriesBuilder test = LocalDateDoubleTimeSeries.builder(); test.putAll(dates, values); assertEquals(test.get(date(2013, 1, 1)), double?.of(2d)); assertEquals(test.get(date(2014, 1, 1)), double?.of(3d)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expectedExceptions = IllegalArgumentException.class) public void test_putAll_collectionsMismatch() public virtual void test_putAll_collectionsMismatch() { LocalDateDoubleTimeSeriesBuilder test = LocalDateDoubleTimeSeries.builder(); test.putAll(Arrays.asList(date(2014, 1, 1)), Doubles.asList(2d, 3d)); }