Class HashBinList
java.lang.Object
uk.ac.starlink.ttools.plot2.layer.HashBinList
- All Implemented Interfaces:
BinList
-
Nested Class Summary
Nested classes/interfaces inherited from interface BinList
BinList.Result -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccumulates all the data from another BinList into this one.static BinList.ResultcreateHashResult(Map<Long, Double> map) Returns a new Result instance based on a Map.getBinContainer(long index) Returns a container representing the current contents of a given bin.Returns the combination method used for bins.getMap()Returns the hash used to store this bin list's state.Returns an object containing the result values accumulated into the bins so far.longgetSize()Returns the maximum number of bins.voidsubmitToBin(long index, double value) Adds a given numeric value to the bin at the given index.
-
Constructor Details
-
HashBinList
Constructor.- Parameters:
size- number of binscombiner- combiner
-
-
Method Details
-
getSize
-
getCombiner
Description copied from interface:BinListReturns the combination method used for bins.- Specified by:
getCombinerin interfaceBinList- Returns:
- combiner
-
submitToBin
public void submitToBin(long index, double value) 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:
index- bin indexvalue- finite value to submit to the bin
-
getBinContainer
Description copied from interface:BinListReturns a container representing the current contents of a given bin. This is only intended for reading; the effect of submitting additional data to the returned container is not defined.This method is here to support conversion between different BinList implementations.
- Specified by:
getBinContainerin interfaceBinList- Parameters:
index- bin index- Returns:
- container instance reporting the current state of the bin; may be null if the bin is not populated
-
addBins
Accumulates all the data from another BinList into this one. The effect is the same as if all the data submitted tootherhad been submitted to this.The other list must be of the same type (have the same combiner) as this one.
- Parameters:
other- second BinList compatible with this one- Throws:
ClassCastException- ifother's type does not match this one
-
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. -
getMap
Returns the hash used to store this bin list's state.- Returns:
- index->container map
-
createHashResult
Returns a new Result instance based on a Map.- Parameters:
map- map of values- Returns:
- result based on
map
-