# Class SplitRunner<S extends uk.ac.starlink.util.Splittable<S>>

java.lang.Object
uk.ac.starlink.ttools.plot2.SplitRunner<S>

Direct Known Subclasses:
  `TupleRunner`

public abstract class SplitRunner<S extends uk.ac.starlink.util.Splittable<S>> extends Object
Utility class for making use of SplitProcessor instances.

Since:
  17 Sep 2019
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`SplitRunner()`

## Method Summary

Modifier and Type
Method
Description
`abstract <A> A`
`collect(uk.ac.starlink.util.SplitCollector<S,A> collector, Supplier<S> splitSupplier)`
Performs a collection operation.
`abstract <A> A`
`collectPool(uk.ac.starlink.util.SplitCollector<S,A> collector, Supplier<S> splitSupplier)`
Performs a collection operation with a hint that accumulator pooling is recommended.
`static <S extends uk.ac.starlink.util.Splittable<S>>
SplitRunner<S>`
`createBenchRunner()`
Returns an instance that invokes multiple SplitProcessor instances of different types and reports comparative timings to stdout.
`static <S extends uk.ac.starlink.util.Splittable<S>>
SplitRunner<S>`
`createDefaultRunner()`
Returns an instance that uses SplitProcessor instances in the normal way with the default concurrency policy.
`static <S extends uk.ac.starlink.util.Splittable<S>>
SplitRunner<S>`
`createSequentialRunner()`
Returns an instance that performs single-threaded sequential execution.
`static <S extends uk.ac.starlink.util.Splittable<S>>
SplitRunner<S>`
`createStandardRunner(uk.ac.starlink.util.SplitPolicy policy)`
Returns an instance that uses SplitProcessor instances in the normal way with a given concurrency policy.
`abstract boolean`
`willAttemptSplit(S content)`
Indicates whether an attempt will be made to split a top-level splittable in order to process it.

### Methods inherited from class Object

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

## Constructor Details

### SplitRunner

public SplitRunner()

## Method Details

### collect

public abstract <A> A collect(uk.ac.starlink.util.SplitCollector<S,A> collector, Supplier<S> splitSupplier)
Performs a collection operation. This usually does not do accumulator pooling.

Parameters:
  `collector` - collector
  `splitSupplier` - supplier for splittable object to process
Returns:
  collected result

### collectPool

public abstract <A> A collectPool(uk.ac.starlink.util.SplitCollector<S,A> collector, Supplier<S> splitSupplier)
Performs a collection operation with a hint that accumulator pooling is recommended.

Parameters:
  `collector` - collector
  `splitSupplier` - supplier for splittable object to process

### willAttemptSplit

public abstract boolean willAttemptSplit(S content)
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.

Parameters:
  `content` - splittable
Returns:
  true iff processing will try to split content

### createDefaultRunner

public static <S extends uk.ac.starlink.util.Splittable<S>> SplitRunner<S> createDefaultRunner()
Returns an instance that uses SplitProcessor instances in the normal way with the default concurrency policy.

Returns:
  default parallel instance

### createStandardRunner

public static <S extends uk.ac.starlink.util.Splittable<S>> SplitRunner<S> createStandardRunner(uk.ac.starlink.util.SplitPolicy policy)
Returns an instance that uses SplitProcessor instances in the normal way with a given concurrency policy.

Parameters:
  `policy` - concurrency policy
Returns:
  standard parallel instance

### createBenchRunner

public static <S extends uk.ac.starlink.util.Splittable<S>> SplitRunner<S> createBenchRunner()
Returns an instance that invokes multiple SplitProcessor instances of different types and reports comparative timings to stdout. This is not intended for production use, obviously.

Returns:
  benchmarking instance

### createSequentialRunner

public static <S extends uk.ac.starlink.util.Splittable<S>> SplitRunner<S> createSequentialRunner()
Returns an instance that performs single-threaded sequential execution.

Returns:
  sequential execution instance