# Class TupleRunner

java.lang.Object
uk.ac.starlink.ttools.plot2.SplitRunner<TupleSequence>
uk.ac.starlink.ttools.plot2.data.TupleRunner

public class TupleRunner extends SplitRunner<TupleSequence>
SplitRunner subclass for use with TupleSequences.

Since:
  17 Sep 2019
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final TupleRunner`
`BENCH`
Tries different implementations and logs timings to stdout.
`static final TupleRunner`
`DEFAULT`
Standard instance for parallel processing.
`static final TupleRunner`
`SEQUENTIAL`
Always runs sequentially, no parallel processing.

## Constructor Summary

Constructors
Constructor
Description
`TupleRunner(SplitRunner<?> runner)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`<A> A`
`collect(uk.ac.starlink.util.SplitCollector<TupleSequence, A> collector, Supplier<TupleSequence> tupleSupplier)`
Performs a collection operation.
`<A> A`
`collectPool(uk.ac.starlink.util.SplitCollector<TupleSequence, A> collector, Supplier<TupleSequence> tupleSupplier)`
Performs a collection operation with a hint that accumulator pooling is recommended.
`SplitRunner<CoordSequence>`
`coordRunner()`
Returns a SplitRunner use with CoordSequences associted with this object.
`void`
`paintData(BiConsumer<TupleSequence, Paper> tuplePainter, Paper paper, DataSpec dataSpec, DataStore dataStore)`
Paints tuple-based data onto a Paper instance, possibly in parallel.
`void`
`rangeData(BiConsumer<TupleSequence, Ranger> rangeFiller, Ranger ranger, DataSpec dataSpec, DataStore dataStore)`
Gathers range information from tuple-based data, possibly in parallel.
`boolean`
`willAttemptSplit(TupleSequence tseq)`
Indicates whether an attempt will be made to split a top-level splittable in order to process it.

### Methods inherited from class SplitRunner

`createBenchRunner, createDefaultRunner, createSequentialRunner, createStandardRunner`

### Methods inherited from class Object

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

## Field Details

### DEFAULT

public static final TupleRunner DEFAULT
Standard instance for parallel processing.

### SEQUENTIAL

public static final TupleRunner SEQUENTIAL
Always runs sequentially, no parallel processing.

### BENCH

public static final TupleRunner BENCH
Tries different implementations and logs timings to stdout.

## Constructor Details

### TupleRunner

public TupleRunner(SplitRunner<?> runner)
Constructor.

Parameters:
  `runner` - provides basic behaviour

## Method Details

### willAttemptSplit

public boolean willAttemptSplit(TupleSequence tseq)
Description copied from class: `SplitRunner`
Indicates whether an attempt will be made to split a top-level splittable in order to process it. If it's too small for instance, false will be returned.

Specified by:
  `willAttemptSplit` in class `SplitRunner<TupleSequence>`
Parameters:
  `tseq` - splittable
Returns:
  true iff processing will try to split content

### collect

public <A> A collect(uk.ac.starlink.util.SplitCollector<TupleSequence, A> collector, Supplier<TupleSequence> tupleSupplier)
Description copied from class: `SplitRunner`
Performs a collection operation. This usually does not do accumulator pooling.

Specified by:
  `collect` in class `SplitRunner<TupleSequence>`
Parameters:
  `collector` - collector
  `tupleSupplier` - supplier for splittable object to process
Returns:
  collected result

### collectPool

public <A> A collectPool(uk.ac.starlink.util.SplitCollector<TupleSequence, A> collector, Supplier<TupleSequence> tupleSupplier)
Description copied from class: `SplitRunner`
Performs a collection operation with a hint that accumulator pooling is recommended.

Specified by:
  `collectPool` in class `SplitRunner<TupleSequence>`
Parameters:
  `collector` - collector
  `tupleSupplier` - supplier for splittable object to process

### paintData

public void paintData(BiConsumer<TupleSequence, Paper> tuplePainter, Paper paper, DataSpec dataSpec, DataStore dataStore)
Paints tuple-based data onto a Paper instance, possibly in parallel. The supplied `tuplePainter` argument corresponds to method `SplitCollector.accumulate(S, A)`.

Parameters:
  `tuplePainter` - defines how a TupleSequence is painted onto paper
  `paper` - paper onto which painting will be done
  `dataSpec` - data spec
  `dataStore` - data storage

### rangeData

public void rangeData(BiConsumer<TupleSequence, Ranger> rangeFiller, Ranger ranger, DataSpec dataSpec, DataStore dataStore)
Gathers range information from tuple-based data, possibly in parallel. The supplied `rangeFiller` argument corresponds to method `SplitCollector.accumulate(S, A)`.

Parameters:
  `rangeFiller` - defines how a TupleSequence is used to populate a ranger
  `ranger` - ranger to which the results will be written
  `dataSpec` - data spec
  `dataStore` - data storage

### coordRunner

public SplitRunner<CoordSequence> coordRunner()
Returns a SplitRunner use with CoordSequences associted with this object.

Returns:
  coord runner