QuantileDigest { @VisibleForTesting boolean equivalent(QuantileDigest other) { return (getNodeCount() == other.getNodeCount() && min == other.min && max == other.max && weightedCount == other.weightedCount && alpha == other.alpha); } QuantileDigest(double maxError);  QuantileDigest(double maxError, double alpha); @VisibleForTesting  QuantileDigest(double maxError, double alpha, Ticker ticker);  QuantileDigest(QuantileDigest other);  QuantileDigest(Slice serialized); double getMaxError(); double getAlpha(); void add(long value); void add(long value, long count); void merge(QuantileDigest other); List<Long> getQuantilesLowerBound(List<Double> quantiles); List<Long> getQuantilesUpperBound(List<Double> quantiles); List<Long> getQuantiles(List<Double> quantiles); long getQuantile(double quantile); long getQuantileLowerBound(double quantile); long getQuantileUpperBound(double quantile); double getCount(); List<Bucket> getHistogram(List<Long> bucketUpperBounds); List<Bucket> getHistogram(List<Long> bucketUpperBounds, MiddleFunction middleFunction); long getMin(); long getMax(); int estimatedInMemorySizeInBytes(); int estimatedSerializedSizeInBytes(); Slice serialize(); double getConfidenceFactor(); @SuppressFBWarnings("VA_FORMAT_STRING_USES_NEWLINE") String toGraphviz();  }
@Test public void testEquivalenceEmpty() { QuantileDigest a = new QuantileDigest(0.01); QuantileDigest b = new QuantileDigest(0.01); assertTrue(a.equivalent(b)); }
@Test public void testEquivalenceComplex() { QuantileDigest a = new QuantileDigest(0.01); QuantileDigest b = new QuantileDigest(0.01); addAll(a, asList(0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7)); addAll(b, asList(0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7)); assertTrue(a.equivalent(b)); }
@Test public void testEquivalenceComplexDifferent() { QuantileDigest a = new QuantileDigest(0.01); QuantileDigest b = new QuantileDigest(0.01); addAll(a, asList(0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7)); addAll(b, asList(0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8)); assertFalse(a.equivalent(b)); }