H - the space the histogram is build over. This may be arbitrary
objects. Note that the bins must be created by yourself. This class just
counts. Also note that this uses a HashMap in the backend, so datapoints/bins
that are equal according to their equals method will be mapped to the same
bin.public class Histogramm<H> extends Object
| Constructor and Description |
|---|
Histogramm() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(Histogramm<H> otherHisto)
Adds all values from another histogramm.
|
Integer |
addDataPoint(H datapoint)
Add a new datapoint/bin (or override an old one).
|
double |
getAverage()
This only works if the given class type is a number.
|
Map<H,Integer> |
getBackingMap()
Returns the backing HashMap.
|
H |
getMaxElement()
Returns the element that was counted the most.
|
int |
getNumber(H datapoint)
Returns the current count for a given datapoint/bin.
|
public void addAll(Histogramm<H> otherHisto)
otherHisto - another histogramm.public Integer addDataPoint(H datapoint)
datapoint - a new datapoint.public int getNumber(H datapoint)
datapoint - a datapoint.public double getAverage()
public Map<H,Integer> getBackingMap()
public H getMaxElement()
Copyright © 2014. All rights reserved.