@Override public Histogram create() { for (int i = 0; i < buckets.length - 1; i++) { if (buckets[i] >= buckets[i + 1]) { throw new IllegalStateException("Histogram buckets must be in increasing order: " + buckets[i] + " >= " + buckets[i + 1]); } } if (buckets.length == 0) { throw new IllegalStateException("Histogram must have at least one bucket."); } for (String label: labelNames) { if (label.equals("le")) { throw new IllegalStateException("Histogram cannot have a label named 'le'."); } } // Append infinity bucket if it's not already there. if (buckets[buckets.length - 1] != Double.POSITIVE_INFINITY) { double[] tmp = new double[buckets.length + 1]; System.arraycopy(buckets, 0, tmp, 0, buckets.length); tmp[buckets.length] = Double.POSITIVE_INFINITY; buckets = tmp; } dontInitializeNoLabelsChild = true; return new Histogram(this); }
@Override public Histogram create() { for (int i = 0; i < buckets.length - 1; i++) { if (buckets[i] >= buckets[i + 1]) { throw new IllegalStateException("Histogram buckets must be in increasing order: " + buckets[i] + " >= " + buckets[i + 1]); } } if (buckets.length == 0) { throw new IllegalStateException("Histogram must have at least one bucket."); } for (String label: labelNames) { if (label.equals("le")) { throw new IllegalStateException("Histogram cannot have a label named 'le'."); } } // Append infinity bucket if it's not already there. if (buckets[buckets.length - 1] != Double.POSITIVE_INFINITY) { double[] tmp = new double[buckets.length + 1]; System.arraycopy(buckets, 0, tmp, 0, buckets.length); tmp[buckets.length] = Double.POSITIVE_INFINITY; buckets = tmp; } dontInitializeNoLabelsChild = true; return new Histogram(this); }