Class HashBinList
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.HashBinList
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface uk.ac.starlink.ttools.plot2.layer.BinList
BinList.Result
-
-
Constructor Summary
Constructors Constructor Description HashBinList(long size, Combiner combiner)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BinList.Result
createHashResult(java.util.Map<java.lang.Long,java.lang.Double> map)
Returns a new Result instance based on a Map.Combiner
getCombiner()
Returns the combination method used for bins.java.util.Map<java.lang.Long,Combiner.Container>
getMap()
Returns the hash used to store this bin list's state.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 index, double value)
Adds a given numeric value to the bin at the given index.
-
-
-
Constructor Detail
-
HashBinList
public HashBinList(long size, Combiner combiner)
Constructor.- Parameters:
size
- number of binscombiner
- combiner
-
-
Method Detail
-
getSize
public long getSize()
Description copied from interface:BinList
Returns the maximum number of bins. All bins have an index in the range 0..size-1.
-
getCombiner
public Combiner getCombiner()
Description copied from interface:BinList
Returns the combination method used for bins.- Specified by:
getCombiner
in interfaceBinList
- Returns:
- combiner
-
submitToBin
public void submitToBin(long index, double value)
Description copied from interface:BinList
Adds a given numeric value to the bin at the given index. In general, NaN values should not be submitted.- Specified by:
submitToBin
in interfaceBinList
- Parameters:
index
- bin indexvalue
- finite value to submit to the bin
-
getResult
public BinList.Result getResult()
Description copied from interface:BinList
Returns 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
public java.util.Map<java.lang.Long,Combiner.Container> getMap()
Returns the hash used to store this bin list's state.- Returns:
- index->container map
-
createHashResult
public static BinList.Result createHashResult(java.util.Map<java.lang.Long,java.lang.Double> map)
Returns a new Result instance based on a Map.- Parameters:
map
- map of values- Returns:
- result based on
map
-
-