@Test(expectedExceptions = UnsupportedOperationException.class) public void testGetMaxBlowup() { final String[] is = {"foo", "bar", "bar"}; final Histogram<String> histo = new Histogram<>(); for (final String i : is) histo.increment(i); histo.getMax();//blow up }
@Test public void testGetMinMax() { final int[] is = {4,4,5,5,5,6,6,6,6}; final Histogram<Integer> histo = new Histogram<>(); for (final int i : is) histo.increment(i); Assert.assertEquals(histo.getMin(), 4.0); Assert.assertEquals(histo.getMax(), 6.0); }
if (!histogram.isEmpty()) { metrics.READ_PAIRS = (long) total; metrics.MAX_INSERT_SIZE = (int) histogram.getMax(); metrics.MIN_INSERT_SIZE = (int) histogram.getMin(); metrics.MEDIAN_INSERT_SIZE = histogram.getMedian(); double high = median; while (low >= histogram.getMin()-1 || high <= histogram.getMax()+1) { final Histogram.Bin<Integer> lowBin = histogram.get((int) low); if (lowBin != null) covered += lowBin.getValue();
if (!histogram.isEmpty()) { metrics.READ_PAIRS = (long) total; metrics.MAX_INSERT_SIZE = (int) histogram.getMax(); metrics.MIN_INSERT_SIZE = (int) histogram.getMin(); metrics.MEDIAN_INSERT_SIZE = histogram.getMedian(); double high = median; while (low >= histogram.getMin()-1 || high <= histogram.getMax()+1) { final Histogram.Bin<Integer> lowBin = histogram.get((int) low); if (lowBin != null) covered += lowBin.getValue();