@Test public void linearRange1() { ListNumber values = new ArrayDouble(5, 3, 7, -1, 2); Cell1DDataset dataset = Cell1DDatasets.linearRange(values, 0, 10); assertThat(dataset.getXCount(), equalTo(5)); assertThat(dataset.getXRange().getMinimum(), equalTo(0.0)); assertThat(dataset.getXRange().getMaximum(), equalTo(10.0)); assertThat(dataset.getStatistics().getAverage(), equalTo(3.2)); assertThat(dataset.getStatistics().getStdDev(), closeTo(2.71293, 0.0001)); assertThat(dataset.getStatistics().getRange().getMinimum(), equalTo((Number) (-1.0))); assertThat(dataset.getStatistics().getRange().getMaximum(), equalTo((Number) 7.0)); assertThat(dataset.getStatistics().getCount(), equalTo(5)); assertThat(dataset.getXBoundaries().getDouble(0), equalTo(0.0)); assertThat(dataset.getValue(0), equalTo(5.0)); assertThat(dataset.getXBoundaries().getDouble(1), equalTo(2.0)); assertThat(dataset.getValue(1), equalTo(3.0)); assertThat(dataset.getXBoundaries().getDouble(2), equalTo(4.0)); assertThat(dataset.getValue(2), equalTo(7.0)); assertThat(dataset.getXBoundaries().getDouble(3), equalTo(6.0)); assertThat(dataset.getValue(3), equalTo(-1.0)); assertThat(dataset.getXBoundaries().getDouble(4), equalTo(8.0)); assertThat(dataset.getValue(4), equalTo(2.0)); assertThat(dataset.getXBoundaries().getDouble(5), equalTo(10.0)); }
public static Cell1DDataset linearRange(final ListNumber values, final double minValue, final double maxValue) { final Statistics statistics = StatisticsUtil.statisticsOf(values); final Range range = Ranges.range(minValue, maxValue); final ListNumber xBoundaries = ListNumbers.linearListFromRange(minValue, maxValue, values.size() + 1); return new Cell1DDataset() { @Override public Range getDisplayRange() { return null; } @Override public double getValue(int x) { return values.getDouble(x); } @Override public Statistics getStatistics() { return statistics; } @Override public ListNumber getXBoundaries() { return xBoundaries; } @Override public Range getXRange() { return range; } @Override public int getXCount() { return values.size(); } }; }
Cell1DDatasets { public static Cell1DDataset linearRange(final ListNumber values, final double minValue, final double maxValue) { final Statistics statistics = StatisticsUtil.statisticsOf(values); final Range range = Ranges.range(minValue, maxValue); final ListNumber xBoundaries = ListNumbers.linearListFromRange(minValue, maxValue, values.size() + 1); return new Cell1DDataset() { @Override public Range getDisplayRange() { return null; } @Override public double getValue(int x) { return values.getDouble(x); } @Override public Statistics getStatistics() { return statistics; } @Override public ListNumber getXBoundaries() { return xBoundaries; } @Override public Range getXRange() { return range; } @Override public int getXCount() { return values.size(); } }; } }
Cell1DDatasets { public static Cell1DDataset linearRange(final ListNumber values, final double minValue, final double maxValue) { final Statistics statistics = StatisticsUtil.statisticsOf(values); final Range range = Ranges.range(minValue, maxValue); final ListNumber xBoundaries = ListNumbers.linearListFromRange(minValue, maxValue, values.size() + 1); return new Cell1DDataset() { @Override public Range getDisplayRange() { return null; } @Override public double getValue(int x) { return values.getDouble(x); } @Override public Statistics getStatistics() { return statistics; } @Override public ListNumber getXBoundaries() { return xBoundaries; } @Override public Range getXRange() { return range; } @Override public int getXCount() { return values.size(); } }; }  }
Cell1DDatasets { public static Cell1DDataset linearRange(final ListNumber values, final double minValue, final double maxValue) { final Statistics statistics = StatisticsUtil.statisticsOf(values); final Range range = Ranges.range(minValue, maxValue); final ListNumber xBoundaries = ListNumbers.linearListFromRange(minValue, maxValue, values.size() + 1); return new Cell1DDataset() { @Override public Range getDisplayRange() { return null; } @Override public double getValue(int x) { return values.getDouble(x); } @Override public Statistics getStatistics() { return statistics; } @Override public ListNumber getXBoundaries() { return xBoundaries; } @Override public Range getXRange() { return range; } @Override public int getXCount() { return values.size(); } }; }  static Cell1DDataset linearRange(final ListNumber values, final double minValue, final double maxValue); static Cell1DDataset datasetFrom(final ListNumber values, final ListNumber xBoundaries); static Cell1DDataset datasetFrom(final ListNumber values, final ListNumber xBoundaries, final Range displayRange); static Cell1DDataset createHistogram(Point1DDataset dataset); }
Cell1DDatasets { public static Cell1DDataset linearRange(final ListNumber values, final double minValue, final double maxValue) { final Statistics statistics = StatisticsUtil.statisticsOf(values); final Range range = Ranges.range(minValue, maxValue); final ListNumber xBoundaries = ListNumbers.linearListFromRange(minValue, maxValue, values.size() + 1); return new Cell1DDataset() { @Override public Range getDisplayRange() { return null; } @Override public double getValue(int x) { return values.getDouble(x); } @Override public Statistics getStatistics() { return statistics; } @Override public ListNumber getXBoundaries() { return xBoundaries; } @Override public Range getXRange() { return range; } @Override public int getXCount() { return values.size(); } }; }  static Cell1DDataset linearRange(final ListNumber values, final double minValue, final double maxValue); static Cell1DDataset datasetFrom(final ListNumber values, final ListNumber xBoundaries); static Cell1DDataset datasetFrom(final ListNumber values, final ListNumber xBoundaries, final Range displayRange); static Cell1DDataset createHistogram(Point1DDataset dataset);  }