Class BinListCollector

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.BinListCollector
All Implemented Interfaces:
uk.ac.starlink.util.SplitCollector<TupleSequence,BinList>

public abstract class BinListCollector extends Object implements uk.ac.starlink.util.SplitCollector<TupleSequence,BinList>
Partial SplitCollector implementation for accumulating data in BinLists.
Since:
27 Sep 2019
Author:
Mark Taylor
  • Constructor Details

    • BinListCollector

      public BinListCollector(Combiner combiner, long nbin)
      Constructor.
      Parameters:
      combiner - combination mode
      nbin - bin index limit
  • Method Details

    • createAccumulator

      public BinList createAccumulator()
      Specified by:
      createAccumulator in interface uk.ac.starlink.util.SplitCollector<TupleSequence,BinList>
    • combine

      public BinList combine(BinList binList1, BinList binList2)
      Specified by:
      combine in interface uk.ac.starlink.util.SplitCollector<TupleSequence,BinList>
    • createDefaultBinList

      public static BinList createDefaultBinList(Combiner combiner, long size)
      Returns a BinList implementation suitable for a given number of bins and a given combiner. This may return an implementation based on a hash, or an array, or some combination.
      Parameters:
      combiner - combiner
      size - maximum number of bins
    • mergeBinLists

      public static BinList mergeBinLists(BinList binList1, BinList binList2)
      Returns a BinList with contents corresponding to the aggregation of two input BinLists. The result is the same as if all the data submitted to the input bin lists had instead been submitted to the output one. The result may or may not be the same object as one of the inputs. The inputs should not be used following this operation.

      This method will work for any BinList instances, but it is intended for use with BinLists generated by createDefaultBinList.

      Parameters:
      binList1 - first input
      binList2 - second input
      Returns:
      aggregation of the inputs