# Class MapBinnedData<K extends Comparable<K>>

java.lang.Object
uk.ac.starlink.ttools.plot.MapBinnedData<K>

All Implemented Interfaces:
  `BinnedData`

public class MapBinnedData<K extends Comparable<K>> extends Object implements BinnedData
BinnedData implementation that uses a map. Bins are dispensed from the iterator in order.

Since:
  14 Nov 2005
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`MapBinnedData.BinMapper<K extends Comparable<K>>`
Defines the mapping of numerical values to map keys.

### Nested classes/interfaces inherited from interface BinnedData

`BinnedData.Bin`

## Constructor Summary

Constructors
Constructor
Description
`MapBinnedData(int nset, MapBinnedData.BinMapper<K> mapper)`
Constructs a new BinnedData.

## Method Summary

Modifier and Type
Method
Description
`static MapBinnedData.BinMapper<Long>`
`createBinMapper(boolean logFlag, double binWidth, double binBase)`
Constructs a new linear or logarithmic BinMapper object.
`Iterator<BinnedData.Bin>`
`getBinIterator(boolean includeEmpty)`
Returns an iterator over the bins managed by this object.
`MapBinnedData.BinMapper<K>`
`getMapper()`
Returns the BinMapper object used by this BinnedData.
`int`
`getSetCount()`
Returns the number of subsets for which this object maintains bins.
`boolean`
`isInteger()`
Indicates whether the count values in the bins are known to be integers.
`void`
`submitDatum(double value, double weight, boolean[] setFlags)`
Submits a value for inclusion in this BinnedData object.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MapBinnedData

public MapBinnedData(int nset, MapBinnedData.BinMapper<K> mapper)
Constructs a new BinnedData.

Parameters:
  `nset` - the number of subsets that this BinnedData can deal with
  `mapper` - a BinMapper implementation that defines the bin ranges

## Method Details

### submitDatum

public void submitDatum(double value, double weight, boolean[] setFlags)
Description copied from interface: `BinnedData`
Submits a value for inclusion in this BinnedData object. As well as the value itself and a weight, a mask of boolean flags is given that indicates which subsets are considered to contain the submitted value.

Specified by:
  `submitDatum` in interface `BinnedData`
Parameters:
  `value` - value for inclusion
  `weight` - weighting
  `setFlags` - array of flags, one for each subset; true for inclusion, false for exclusion

### getBinIterator

public Iterator<BinnedData.Bin> getBinIterator(boolean includeEmpty)
Description copied from interface: `BinnedData`
Returns an iterator over the bins managed by this object. The bins must be returned in order (lowest data range bin to highest data range bin).

It is inadvisable to call `BinnedData.submitDatum(double, double, boolean[])` during the lifetime of this iterator.

Specified by:
  `getBinIterator` in interface `BinnedData`
Parameters:
  `includeEmpty` - if true, then all bins between the lowest and highest must be iterated over. If false, then empty bins may be omitted
Returns:
  iterator which dispenses `BinnedData.Bin` instances

### getSetCount

public int getSetCount()
Description copied from interface: `BinnedData`
Returns the number of subsets for which this object maintains bins.

Specified by:
  `getSetCount` in interface `BinnedData`
Returns:
  set count

### isInteger

public boolean isInteger()
Description copied from interface: `BinnedData`
Indicates whether the count values in the bins are known to be integers.

Specified by:
  `isInteger` in interface `BinnedData`
Returns:
  true if all `Bin.getWeightedCount` returns are integer values

### getMapper

public MapBinnedData.BinMapper<K> getMapper()
Returns the BinMapper object used by this BinnedData.

Returns:
  bin mapper

### createBinMapper

public static MapBinnedData.BinMapper<Long> createBinMapper(boolean logFlag, double binWidth, double binBase)
Constructs a new linear or logarithmic BinMapper object.

Parameters:
  `logFlag` - false for linear spacing, true for logarithmic
  `binWidth` - bin spacing (additive for linear, multiplicative for logarithmic)
  `binBase` - lower bound of one (any) bin; determines bin phase
Returns:
  new bin mapper