uk.ac.starlink.ttools.plot2.layer
Interface BinList

All Known Implementing Classes:
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
static interface BinList.Result
          Accessor for the results of accumulating values in a bit list.
 
Method Summary
 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 Detail

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


Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.