Package uk.ac.starlink.ttools.plot2.data
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.Splittable<TupleSequence>
,uk.ac.starlink.util.SplittableSequence<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, java.util.function.BooleanSupplier abortCondition)
Constructor with checking period of 1 (every element).AbortTupleSequence(TupleSequence base, java.util.function.BooleanSupplier abortCondition, int checkPeriod)
Constructor with specified checking period.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isAborted()
Indicates whether the abort condition has been detected.boolean
next()
AbortTupleSequence
split()
long
splittableSize()
-
Methods inherited from class uk.ac.starlink.ttools.plot2.data.WrapperTuple
getBooleanValue, getDoubleValue, getIntValue, getLongValue, getObjectValue, getRowIndex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.ac.starlink.ttools.plot2.data.Tuple
getBooleanValue, getDoubleValue, getIntValue, getLongValue, getObjectValue, getRowIndex
-
-
-
-
Constructor Detail
-
AbortTupleSequence
public AbortTupleSequence(TupleSequence base, java.util.function.BooleanSupplier abortCondition)
Constructor with checking period of 1 (every element).- Parameters:
base
- base sequenceabortCondition
- condition on which the stream should stop
-
AbortTupleSequence
public AbortTupleSequence(TupleSequence base, java.util.function.BooleanSupplier abortCondition, int checkPeriod)
Constructor with specified checking period.- Parameters:
base
- base sequenceabortCondition
- condition on which the stream should stopcheckPeriod
- approximate frequency of checking the condition
-
-
Method Detail
-
next
public boolean next()
- Specified by:
next
in interfaceuk.ac.starlink.util.SplittableSequence<TupleSequence>
-
split
public AbortTupleSequence split()
- Specified by:
split
in interfaceuk.ac.starlink.util.Splittable<TupleSequence>
-
splittableSize
public long splittableSize()
- Specified by:
splittableSize
in interfaceuk.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
-
-