# Interface BinList

All Known Implementing Classes:
  `AdaptiveBinList, ArrayBinList, HashBinList`

public interface BinList
Represents a bounded list of bins. Each bin is given a fixed integer label, from zero to a specified maximum. In practice, not all the bins may be used, and implementations may take advantage of this.

Zero or more data values may be submitted to each bin, and a floating point result value may later be obtained from each bin, which forms a digest of the values submitted to that bin. The nature of this digest is determined by a Combiner object.

Instances of this class are in general not thread-safe.

Since:
  20 Sep 2015
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`BinList.Result`
Accessor for the results of accumulating values in a bit list.

## Method Summary

Modifier and Type
Method
Description
`Combiner.Container`
`getBinContainer(long index)`
Returns a container representing the current contents of a given bin.
`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 index, double datum)`
Adds a given numeric value to the bin at the given index.

## Method Details

### getSize

long getSize()
Returns the maximum number of bins. All bins have an index in the range 0..size-1.

Returns:
  bin count

### getCombiner

Combiner getCombiner()
Returns the combination method used for bins.

Returns:
  combiner

### submitToBin

void submitToBin(long index, double datum)
Adds a given numeric value to the bin at the given index. In general, NaN values should not be submitted.

Parameters:
  `index` - bin index
  `datum` - finite value to submit to the bin

### getResult

BinList.Result getResult()
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 `submitToBin(long, double)` calls.

Returns:
  accumulated bin values

### getBinContainer

Combiner.Container getBinContainer(long index)
Returns 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.

Parameters:
  `index` - bin index
Returns:
  container instance reporting the current state of the bin; may be null if the bin is not populated