public class Histogram
extends java.lang.Object
Constructor and Description |
---|
Histogram()
Create an empty histogram object with a default bin size of 0.1
|
Histogram(java.lang.Double binSize)
Create an empty histogram object with a with a specified bin size
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.Double d)
Add a value to be stored in the histogram
|
void |
add(java.lang.Double d,
int count)
Add multiple copies of the same value into the histogram to be stored in the histogram
|
void |
add(Histogram h)
Combine two histogram objects that have the same bin by adding the values to each bin
|
java.lang.Integer |
get(java.lang.Double d)
Return the count of items in the bin corresponding to the provided value
|
boolean |
isEmpty() |
java.lang.Double |
median() |
java.lang.String |
toString() |
public Histogram()
public Histogram(java.lang.Double binSize)
binSize
- size of the bins to compress the data intopublic void add(java.lang.Double d)
d
- Data to be added to the histogrampublic void add(java.lang.Double d, int count)
d
- Data to be added to the histogramcount
- number of repetitions of the value to add to the histogrampublic void add(Histogram h)
h
- histogram to addpublic java.lang.Integer get(java.lang.Double d)
d
- Value to testpublic java.lang.Double median()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isEmpty()