public abstract class ArrayBinList extends Object implements BinList
BinList.Result
Modifier | Constructor and Description |
---|---|
protected |
ArrayBinList(int size,
Combiner combiner)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addBin(int index,
ArrayBinList other)
Accumulates the contents of a numbered bin from another BinList into
the corresponding bin of this BinList.
|
void |
addBins(ArrayBinList other)
Accumulates all the data from another BinList into this one.
|
protected abstract void |
copyBin(int index,
Combiner.Container container)
Copies bin content from a Container into the storage used by this
implementation for a given bin.
|
static BinList.Result |
createDoubleMaskResult(BitSet mask,
double[] values)
Returns a Result implementation based on a bin occupation mask
and an array of bin content values.
|
static ArrayBinList |
fromHashBinList(HashBinList in)
Tries to create an ArrayBinList with the same content as a
supplied HashBinList.
|
Combiner.Container |
getBinContainer(long index)
Returns a container representing the current contents of a given bin.
|
protected abstract double |
getBinResultInt(int index)
Variant of the
getValue method
that takes a 32-bit index. |
Combiner |
getCombiner()
Returns the combination method used for bins.
|
BinList.Result |
getResult()
Returns an object containing the result values accumulated into
the bins so far.
|
long |
getSize()
Returns the maximum number of bins.
|
void |
submitToBin(long lndex,
double datum)
Adds a given numeric value to the bin at the given index.
|
protected abstract void |
submitToBinInt(int index,
double value)
Variant of the
addToBin method
that takes a 32-bit index. |
protected ArrayBinList(int size, Combiner combiner)
size
- bin countcombiner
- combinerprotected abstract void submitToBinInt(int index, double value)
addToBin
method
that takes a 32-bit index.index
- bin indexvalue
- increment for the current bin valueprotected abstract double getBinResultInt(int index)
getValue
method
that takes a 32-bit index.index
- bin indexprotected abstract void copyBin(int index, Combiner.Container container)
index
- bin indexcontainer
- combiner's container containing bin stateprotected abstract void addBin(int index, ArrayBinList other)
other
had been submitted to the corresponding bin of this.
The other list must be of the same type as this one.
index
- index of a non-empty bin in the other listother
- second ArrayBinList compatible with this oneClassCastException
- if other
's type
does not match this onepublic void submitToBin(long lndex, double datum)
BinList
submitToBin
in interface BinList
lndex
- bin indexdatum
- finite value to submit to the binpublic long getSize()
BinList
public Combiner getCombiner()
BinList
getCombiner
in interface BinList
public BinList.Result getResult()
BinList
It is up to implementations to decide how to implement this method.
In some cases the return value may be an adapter that extracts results
as required from the data structure used for value accumulation,
but in others it may return a new data structure which copies
the accumulated values to a more compact form up front.
Therefore this may or may not be an expensive method, and the return
value may or may not be affected by subsequent
BinList.submitToBin(long, double)
calls.
public Combiner.Container getBinContainer(long index)
BinList
This method is here to support conversion between different BinList implementations.
getBinContainer
in interface BinList
index
- bin indexpublic void addBins(ArrayBinList other)
other
had been submitted to this.
The other list must be compatible with this one; of the same type and with the same bin count.
other
- second ArrayBinList compatible with this oneClassCastException
- if other
's type
does not match this onepublic static ArrayBinList fromHashBinList(HashBinList in)
in
- bin list whose data is to be copiedpublic static BinList.Result createDoubleMaskResult(BitSet mask, double[] values)
mask
- bin occupation maskvalues
- data values per binCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.