@Test public void convert() { Series<String, Number> series = new Series<>(); Point<String, Number> point1 = new Point<>("A", 123); Point<String, Number> point2 = new Point<>("B", 245); series.addPoint(point1); series.addPoint(point2); Number[] flotPoint1 = new Number[]{0, 123}; Number[] flotPoint2 = new Number[]{1, 245}; FlotSeries uiSeries = seriesConverter.convert(series); assertNotNull(uiSeries); assertEquals(2, uiSeries.getPoints().size()); assertArrayEquals(flotPoint1, uiSeries.getPoints().get(0)); assertArrayEquals(flotPoint2, uiSeries.getPoints().get(1)); }
public FlotSeries convert(Series<?, Number> series) { Preconditions.checkNotNull(series); FlotSeries flotSeries = new FlotSeries(); for (int i=0; i<series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); flotSeries.addPoint(i, point.getY()); } return flotSeries; }
SeriesConverter { public FlotSeries convert(Series<?, Number> series) { Preconditions.checkNotNull(series); FlotSeries flotSeries = new FlotSeries(); for (int i=0; i<series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); flotSeries.addPoint(i, point.getY()); } return flotSeries; } }
SeriesConverter { public FlotSeries convert(Series<?, Number> series) { Preconditions.checkNotNull(series); FlotSeries flotSeries = new FlotSeries(); for (int i=0; i<series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); flotSeries.addPoint(i, point.getY()); } return flotSeries; }  }
SeriesConverter { public FlotSeries convert(Series<?, Number> series) { Preconditions.checkNotNull(series); FlotSeries flotSeries = new FlotSeries(); for (int i=0; i<series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); flotSeries.addPoint(i, point.getY()); } return flotSeries; }  FlotSeries convert(Series<?, Number> series); }
SeriesConverter { public FlotSeries convert(Series<?, Number> series) { Preconditions.checkNotNull(series); FlotSeries flotSeries = new FlotSeries(); for (int i=0; i<series.getPoints().size(); i++) { Point<?, Number> point = series.getPoints().get(i); flotSeries.addPoint(i, point.getY()); } return flotSeries; }  FlotSeries convert(Series<?, Number> series);  }