# Class AbortTupleSequence

java.lang.Object
uk.ac.starlink.ttools.plot2.data.WrapperTuple
uk.ac.starlink.ttools.plot2.data.AbortTupleSequence

All Implemented Interfaces:
  `Tuple, TupleSequence, uk.ac.starlink.util.Sequence, uk.ac.starlink.util.Splittable<TupleSequence>`

public class AbortTupleSequence extends WrapperTuple implements TupleSequence
Wrapping TupleSequence that tries to give up when a condition becomes true.

Since:
  12 Aug 2019
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`AbortTupleSequence(TupleSequence base, BooleanSupplier abortCondition)`
Constructor with checking period of 1 (every element).
`AbortTupleSequence(TupleSequence base, BooleanSupplier abortCondition, int checkPeriod)`
Constructor with specified checking period.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`isAborted()`
Indicates whether the abort condition has been detected.
`boolean`
`next()`
Advances to the next entry.
`AbortTupleSequence`
`split()`
`long`
`splittableSize()`

### Methods inherited from class WrapperTuple

`getBooleanValue, getDoubleValue, getIntValue, getLongValue, getObjectValue, getRowIndex`

### Methods inherited from class Object

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

### Methods inherited from interface Tuple

`getBooleanValue, getDoubleValue, getIntValue, getLongValue, getObjectValue, getRowIndex`

## Constructor Details

### AbortTupleSequence

public AbortTupleSequence(TupleSequence base, BooleanSupplier abortCondition)
Constructor with checking period of 1 (every element).

Parameters:
  `base` - base sequence
  `abortCondition` - condition on which the stream should stop

### AbortTupleSequence

public AbortTupleSequence(TupleSequence base, BooleanSupplier abortCondition, int checkPeriod)
Constructor with specified checking period.

Parameters:
  `base` - base sequence
  `abortCondition` - condition on which the stream should stop
  `checkPeriod` - approximate frequency of checking the condition

## Method Details

### next

public boolean next()
Description copied from interface: `TupleSequence`
Advances to the next entry. No exception is thrown.

Specified by:
  `next` in interface `uk.ac.starlink.util.Sequence`
Specified by:
  `next` in interface `TupleSequence`

### split

public AbortTupleSequence split()

Specified by:
  `split` in interface `uk.ac.starlink.util.Splittable<TupleSequence>`

### splittableSize

public long splittableSize()

Specified by:
  `splittableSize` in interface `uk.ac.starlink.util.Splittable<TupleSequence>`

### isAborted

public boolean isAborted()
Indicates whether the abort condition has been detected.

Returns:
  true iff the abort condition has been detected