@Test public void testAggregateWithTheSameName() { final List<Bar> bars = new LinkedList<>(); final ZonedDateTime time = ZonedDateTime.of(2019, 6, 12, 4, 1, 0, 0, ZoneId.systemDefault()); final Bar bar0 = new MockBar(time, 1d, 2d, 3d, 4d, 5d, 6d, 7, numFunction); final Bar bar1 = new MockBar(time.plusDays(1), 2d, 3d, 3d, 4d, 5d, 6d, 7, numFunction); final Bar bar2 = new MockBar(time.plusDays(2), 3d, 4d, 4d, 5d, 6d, 7d, 7, numFunction); bars.add(bar0); bars.add(bar1); bars.add(bar2); final BarSeries barSeries = new BaseBarSeries("name", bars); final BarSeries aggregated = baseBarSeriesAggregator.aggregate(barSeries); assertEquals("name", aggregated.getName()); assertEquals(2, aggregated.getBarCount()); assertSame(bar0, aggregated.getBar(0)); assertSame(bar2, aggregated.getBar(1)); }
@Override public BarSeries aggregate(BarSeries series, String aggregatedSeriesName) { final List<Bar> aggregatedBars = barAggregator.aggregate(series.getBarData()); return new BaseBarSeries(aggregatedSeriesName, aggregatedBars); }
BaseBarSeriesAggregator implements BarSeriesAggregator { @Override public BarSeries aggregate(BarSeries series, String aggregatedSeriesName) { final List<Bar> aggregatedBars = barAggregator.aggregate(series.getBarData()); return new BaseBarSeries(aggregatedSeriesName, aggregatedBars); } }
BaseBarSeriesAggregator implements BarSeriesAggregator { @Override public BarSeries aggregate(BarSeries series, String aggregatedSeriesName) { final List<Bar> aggregatedBars = barAggregator.aggregate(series.getBarData()); return new BaseBarSeries(aggregatedSeriesName, aggregatedBars); } BaseBarSeriesAggregator(BarAggregator barAggregator); }
BaseBarSeriesAggregator implements BarSeriesAggregator { @Override public BarSeries aggregate(BarSeries series, String aggregatedSeriesName) { final List<Bar> aggregatedBars = barAggregator.aggregate(series.getBarData()); return new BaseBarSeries(aggregatedSeriesName, aggregatedBars); } BaseBarSeriesAggregator(BarAggregator barAggregator); @Override BarSeries aggregate(BarSeries series, String aggregatedSeriesName); }
BaseBarSeriesAggregator implements BarSeriesAggregator { @Override public BarSeries aggregate(BarSeries series, String aggregatedSeriesName) { final List<Bar> aggregatedBars = barAggregator.aggregate(series.getBarData()); return new BaseBarSeries(aggregatedSeriesName, aggregatedBars); } BaseBarSeriesAggregator(BarAggregator barAggregator); @Override BarSeries aggregate(BarSeries series, String aggregatedSeriesName);  }