Class ObjHistogram<T>
- java.lang.Object
-
- elki.utilities.datastructures.histogram.AbstractStaticHistogram
-
- elki.utilities.datastructures.histogram.ObjHistogram<T>
-
- Type Parameters:
T- Data type
- All Implemented Interfaces:
Histogram
- Direct Known Subclasses:
AbstractObjDynamicHistogram
public class ObjHistogram<T> extends AbstractStaticHistogram
Histogram class storing double values.The histogram will start with "bin" bins, but it can grow dynamicall to the left and right.
- Since:
- 0.5.5
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceObjHistogram.BucketFactory<T>Function to make new buckets.classObjHistogram.IterIterator class.
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Object[]dataData store(package private) java.lang.Object[]specialSpecial value storage: infinity, NaN(package private) ObjHistogram.BucketFactory<T>supplierSupplier for empty bins.-
Fields inherited from class elki.utilities.datastructures.histogram.AbstractStaticHistogram
base, binsize, max, offset, size
-
Fields inherited from interface elki.utilities.datastructures.histogram.Histogram
CACHE_SHIFT
-
-
Constructor Summary
Constructors Constructor Description ObjHistogram(int bins, double min, double max, ObjHistogram.BucketFactory<T> supplier)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget(double coord)Access the value of a bin with new data.protected TgetSpecial(int idx)Ensure that we have storage for special values (infinity, NaN)ObjHistogram.Iteriter()Get an iterator over all histogram bins.-
Methods inherited from class elki.utilities.datastructures.histogram.AbstractStaticHistogram
getBinNr, getBinsize, getCoverMaximum, getCoverMinimum, getNumBins, growSize
-
-
-
-
Field Detail
-
data
java.lang.Object[] data
Data store
-
special
java.lang.Object[] special
Special value storage: infinity, NaN
-
supplier
ObjHistogram.BucketFactory<T> supplier
Supplier for empty bins.
-
-
Constructor Detail
-
ObjHistogram
public ObjHistogram(int bins, double min, double max, ObjHistogram.BucketFactory<T> supplier)Constructor.- Parameters:
bins- Number of binsmin- Cover minimummax- Cover maximumsupplier- Supplier to fill empty bins
-
-
Method Detail
-
get
public T get(double coord)
Access the value of a bin with new data.- Parameters:
coord- Coordinate- Returns:
- bin contents
-
getSpecial
protected T getSpecial(int idx)
Ensure that we have storage for special values (infinity, NaN)- Parameters:
idx- Index to return.
-
iter
public ObjHistogram.Iter iter()
Description copied from class:AbstractStaticHistogramGet an iterator over all histogram bins.- Specified by:
iterin interfaceHistogram- Specified by:
iterin classAbstractStaticHistogram- Returns:
- Iterator
-
-