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

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

All Implemented Interfaces:
  `uk.ac.starlink.util.SplitCollector<S,Range[]>`

public abstract class RangeCollector<S extends uk.ac.starlink.util.Splittable<S>> extends Object implements uk.ac.starlink.util.SplitCollector<S,Range[]>
Partial SplitCollector implementation for accumulating range data. The `accumulate` method should be implemented to submit values to an N-element array of ranges.

On completion, the `mergeRanges(Range[], Range[])` method may be used to update a supplied Range array with the collected result.

Since:
  22 Jan 2021
Author:
  Mark Taylor

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`RangeCollector(int ndim)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`Range[]`
`combine(Range[] ranges1, Range[] ranges2)`
`Range[]`
`createAccumulator()`
`void`
`mergeRanges(Range[] ranges0, Range[] ranges1)`
Merges the content of the second range into the first one.

### Methods inherited from class Object

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

### Methods inherited from interface uk.ac.starlink.util.SplitCollector

`accumulate`

## Constructor Details

### RangeCollector

protected RangeCollector(int ndim)
Constructor.

Parameters:
  `ndim` - number of range objects (data dimensions)

## Method Details

### createAccumulator

public Range[] createAccumulator()

Specified by:
  `createAccumulator` in interface `uk.ac.starlink.util.SplitCollector<S extends uk.ac.starlink.util.Splittable<S>, Range[]>`

### combine

public Range[] combine(Range[] ranges1, Range[] ranges2)

Specified by:
  `combine` in interface `uk.ac.starlink.util.SplitCollector<S extends uk.ac.starlink.util.Splittable<S>, Range[]>`

### mergeRanges

public void mergeRanges(Range[] ranges0, Range[] ranges1)
Merges the content of the second range into the first one.

Parameters:
  `ranges0` - first input range, modified on exit
  `ranges1` - second input range, unmodified on exit