|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.math.ReplacingHistogram<T>
T
- Histogram data type.public class ReplacingHistogram<T>
Class to manage a simple Histogram. Note: the iterator returns pairs containing the coordinate and the bin value!
Nested Class Summary | |
---|---|
static class |
ReplacingHistogram.Adapter<T>
Interface to plug in a data type T. |
protected class |
ReplacingHistogram.Iter
Iterator class to iterate over all bins. |
protected class |
ReplacingHistogram.RIter
Iterator class to iterate over all bins. |
Field Summary | |
---|---|
protected double |
base
Array 'base', i.e. the point of 0.0. |
protected double |
binsize
Width of a bin. |
protected ArrayList<T> |
data
Data storage |
private ReplacingHistogram.Adapter<T> |
maker
Constructor for new elements |
protected double |
max
To avoid introducing an extra bucket for the maximum value. |
protected int |
offset
Array shift to account for negative indices. |
protected int |
size
Size of array storage. |
Constructor Summary | |
---|---|
ReplacingHistogram(int bins,
double min,
double max)
Histogram constructor without 'Constructor' to generate new elements. |
|
ReplacingHistogram(int bins,
double min,
double max,
ReplacingHistogram.Adapter<T> maker)
Histogram constructor |
Method Summary | |
---|---|
static ReplacingHistogram<Pair<Double,Double>> |
DoubleDoubleHistogram(int bins,
double min,
double max)
Convenience constructor for Histograms with pairs of Doubles Uses a constructor to initialize bins with Pair(Double(0),Double(0)) |
static ReplacingHistogram<Double> |
DoubleHistogram(int bins,
double min,
double max)
Convenience constructor for Double-based Histograms. |
T |
get(double coord)
Get the data at a given Coordinate. |
protected int |
getBinNr(double coord)
Compute the bin number. |
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!) |
ArrayList<T> |
getData()
Get the raw data. |
int |
getNumBins()
Get the number of bins actually in use. |
static ReplacingHistogram<Integer> |
IntHistogram(int bins,
double min,
double max)
Convenience constructor for Integer-based Histograms. |
static ReplacingHistogram<Pair<Integer,Integer>> |
IntIntHistogram(int bins,
double min,
double max)
Convenience constructor for Histograms with pairs of Integers Uses a constructor to initialize bins with Pair(Integer(0),Integer(0)) |
Iterator<Pair<Double,T>> |
iterator()
Get an iterator over all histogram bins. |
protected T |
make()
Make a new bin. |
private void |
putBin(int bin,
T d)
Internal put function to handle the special cases of histogram resizing. |
void |
replace(double coord,
T d)
Put data at a given coordinate. |
Iterator<Pair<Double,T>> |
reverseIterator()
Get an iterator over all histogram bins. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int offset
protected int size
protected double base
protected double max
protected double binsize
protected ArrayList<T> data
private ReplacingHistogram.Adapter<T> maker
Constructor Detail |
---|
public ReplacingHistogram(int bins, double min, double max, ReplacingHistogram.Adapter<T> maker)
bins
- Number of bins to use.min
- Minimum Valuemax
- Maximum Valuemaker
- Constructor for new elements.public ReplacingHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum valuemax
- Maximum value.Method Detail |
---|
public T get(double coord)
coord
- Coordinate.
public void replace(double coord, T d)
coord
- Coordinated
- New Dataprotected int getBinNr(double coord)
coord
- Coordinate
private void putBin(int bin, T d)
bin
- bin numberd
- data to putpublic int getNumBins()
public double getBinsize()
public double getCoverMinimum()
public double getCoverMaximum()
public ArrayList<T> getData()
protected T make()
public Iterator<Pair<Double,T>> iterator()
iterator
in interface Iterable<Pair<Double,T>>
public Iterator<Pair<Double,T>> reverseIterator()
public static ReplacingHistogram<Integer> IntHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
public static ReplacingHistogram<Double> DoubleHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
public static ReplacingHistogram<Pair<Integer,Integer>> IntIntHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
public static ReplacingHistogram<Pair<Double,Double>> DoubleDoubleHistogram(int bins, double min, double max)
bins
- Number of binsmin
- Minimum coordinatemax
- Maximum coordinate
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |