Class ArrayBinList
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.ArrayBinList
-
- All Implemented Interfaces:
BinList
public abstract class ArrayBinList extends java.lang.Object implements BinList
Abstract subclass of BinList suitable for implementations based on arrays. The defining feature is that the the maximum bin count can be described as an int rather than a long.- Since:
- 5 Oct 2015
- Author:
- Mark Taylor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface uk.ac.starlink.ttools.plot2.layer.BinList
BinList.Result
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedArrayBinList(int size, Combiner combiner)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BinList.ResultcreateDoubleMaskResult(java.util.BitSet mask, double[] values)Returns a Result implementation based on a bin occupation mask and an array of bin content values.protected abstract doublegetBinResultInt(int index)Variant of thegetValuemethod that takes a 32-bit index.CombinergetCombiner()Returns the combination method used for bins.BinList.ResultgetResult()Returns an object containing the result values accumulated into the bins so far.longgetSize()Returns the maximum number of bins.voidsubmitToBin(long lndex, double datum)Adds a given numeric value to the bin at the given index.protected abstract voidsubmitToBinInt(int index, double value)Variant of theaddToBinmethod that takes a 32-bit index.
-
-
-
Constructor Detail
-
ArrayBinList
protected ArrayBinList(int size, Combiner combiner)Constructor.- Parameters:
size- bin countcombiner- combiner
-
-
Method Detail
-
submitToBinInt
protected abstract void submitToBinInt(int index, double value)Variant of theaddToBinmethod that takes a 32-bit index.- Parameters:
index- bin indexvalue- increment for the current bin value
-
getBinResultInt
protected abstract double getBinResultInt(int index)
Variant of thegetValuemethod that takes a 32-bit index.- Parameters:
index- bin index- Returns:
- bin value
-
submitToBin
public void submitToBin(long lndex, double datum)Description copied from interface:BinListAdds a given numeric value to the bin at the given index. In general, NaN values should not be submitted.- Specified by:
submitToBinin interfaceBinList- Parameters:
lndex- bin indexdatum- finite value to submit to the bin
-
getSize
public long getSize()
Description copied from interface:BinListReturns the maximum number of bins. All bins have an index in the range 0..size-1.
-
getCombiner
public Combiner getCombiner()
Description copied from interface:BinListReturns the combination method used for bins.- Specified by:
getCombinerin interfaceBinList- Returns:
- combiner
-
getResult
public BinList.Result getResult()
Description copied from interface:BinListReturns an object containing the result values accumulated into the bins so far.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.
-
createDoubleMaskResult
public static BinList.Result createDoubleMaskResult(java.util.BitSet mask, double[] values)
Returns a Result implementation based on a bin occupation mask and an array of bin content values.- Parameters:
mask- bin occupation maskvalues- data values per bin
-
-