Widening and actually implement Cloneable.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2487 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2008-11-18 22:14:42 +00:00
parent 893e5ca9dd
commit d7321d2c20
+11 -14
View File
@@ -23,15 +23,15 @@ package com.samskivert.util;
import java.util.Arrays; import java.util.Arrays;
/** /**
* Used for tracking a set of values that fall into a discrete range of * Used for tracking a set of values that fall into a discrete range of values.
* values.
*/ */
public class Histogram public class Histogram
implements Cloneable
{ {
/** /**
* Constructs a histogram that will track values with a granularity * Constructs a histogram that will track values with a granularity equal to the
* equal to the <code>bucketWidth</code> from <code>minValue</code> to * <code>bucketWidth</code> from <code>minValue</code> to <code>minValue +
* <code>minValue + bucketWidth*bucketCount</code>. * bucketWidth*bucketCount</code>.
*/ */
public Histogram (int minValue, int bucketWidth, int bucketCount) public Histogram (int minValue, int bucketWidth, int bucketCount)
{ {
@@ -73,11 +73,10 @@ public class Histogram
} }
/** /**
* Returns the array containing the bucket values. The zeroth element * Returns the array containing the bucket values. The zeroth element contains the count of all
* contains the count of all values less than <code>minValue</code>, * values less than <code>minValue</code>, the subsequent <code>bucketCount</code> elements
* the subsequent <code>bucketCount</code> elements contain the count * contain the count of values falling into those buckets and the last element contains values
* of values falling into those buckets and the last element contains * greater than or equal to <code>maxValue</code>.
* values greater than or equal to <code>maxValue</code>.
*/ */
public int[] getBuckets () public int[] getBuckets ()
{ {
@@ -85,8 +84,7 @@ public class Histogram
} }
/** /**
* Generates a terse summary of the count and contents of the values * Generates a terse summary of the count and contents of the values in this histogram.
* in this histogram.
*/ */
public String summarize () public String summarize ()
{ {
@@ -116,8 +114,7 @@ public class Histogram
@Override // from Object @Override // from Object
public String toString () public String toString ()
{ {
return "[min=" + _minValue + ", max=" + _maxValue + return "[min=" + _minValue + ", max=" + _maxValue + ", bwidth=" + _bucketWidth +
", bwidth=" + _bucketWidth +
", buckets=" + StringUtil.toString(_buckets) + "]"; ", buckets=" + StringUtil.toString(_buckets) + "]";
} }