T
- Data typepublic abstract class AbstractObjDynamicHistogram<T> extends AbstractObjStaticHistogram<T>
AbstractObjStaticHistogram.Iter
Modifier and Type | Field and Description |
---|---|
private int |
cachefill
Cache fill size
|
private double[] |
cacheposs
Cache for positions to be inserted.
|
private Object[] |
cachevals
Cache for data to be inserted.
|
private int |
destsize
Destination (minimum) size of the structure.
|
data, special
base, binsize, max, offset, size
CACHE_SHIFT
Constructor and Description |
---|
AbstractObjDynamicHistogram(int bins)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract T |
aggregate(T first,
T second)
Rule to combine two bins or entries into one.
|
protected void |
aggregateSpecial(T value,
int bin)
Aggregate for a special value.
|
protected abstract T |
cloneForCache(T data)
Clone a data passed to the algorithm for computing the initial size.
|
protected abstract T |
downsample(Object[] data,
int start,
int end,
int size)
Perform downsampling on a number of bins.
|
T |
get(double coord)
Access the value of a bin with new data.
|
double |
getBinsize()
Get the size (width) of a bin.
|
double |
getCoverMaximum()
Get maximum (covered by bins, not data!)
|
double |
getCoverMinimum()
Get minimum (covered by bins, not data!)
|
int |
getNumBins()
Get the number of bins actually in use.
|
AbstractObjStaticHistogram.Iter |
iter()
Get an iterator over all histogram bins.
|
(package private) void |
materialize()
Materialize the histogram from the cache.
|
void |
putData(double coord,
T value)
Put fresh data into the histogram (or into the cache)
|
private void |
testResample(double coord)
Test (and perform) downsampling when neede.
|
getSpecial, makeObject
getBinNr, growSize
private double[] cacheposs
private Object[] cachevals
private int cachefill
private int destsize
public AbstractObjDynamicHistogram(int bins)
bins
- Design number of bins - may become twice as large!void materialize()
public T get(double coord)
AbstractObjStaticHistogram
get
in class AbstractObjStaticHistogram<T>
coord
- Coordinatepublic void putData(double coord, T value)
coord
- Coordinatevalue
- Valueprotected void aggregateSpecial(T value, int bin)
value
- Parameter valuebin
- Special bin index.private void testResample(double coord)
coord
- coordinate to accomodate.public AbstractObjStaticHistogram.Iter iter()
AbstractStaticHistogram
iter
in interface Histogram
iter
in interface ObjHistogram<T>
iter
in class AbstractObjStaticHistogram<T>
public int getNumBins()
AbstractStaticHistogram
getNumBins
in interface Histogram
getNumBins
in class AbstractStaticHistogram
public double getBinsize()
AbstractStaticHistogram
getBinsize
in interface Histogram
getBinsize
in class AbstractStaticHistogram
public double getCoverMinimum()
AbstractStaticHistogram
getCoverMinimum
in interface Histogram
getCoverMinimum
in class AbstractStaticHistogram
public double getCoverMaximum()
AbstractStaticHistogram
getCoverMaximum
in interface Histogram
getCoverMaximum
in class AbstractStaticHistogram
protected abstract T downsample(Object[] data, int start, int end, int size)
data
- Data array (needs cast!)start
- Interval startend
- Interval end (exclusive)size
- Intended size - extra bins are assumed to be empty, should be a
power of twoprotected abstract T aggregate(T first, T second)
first
- First bin valuesecond
- Second bin value