Module org.tquadrat.foundation.base
Class AggregatingSpliterator<I>
java.lang.Object
org.tquadrat.foundation.stream.internal.AggregatingSpliterator<I>
- Type Parameters:
I
- The type of the stream elements.
- All Implemented Interfaces:
Spliterator<List<I>>
@ClassVersion(sourceVersion="$Id: AggregatingSpliterator.java 1060 2023-09-24 19:21:40Z tquadrat $")
@API(status=INTERNAL,
since="0.0.7")
public class AggregatingSpliterator<I>
extends Object
implements Spliterator<List<I>>
An implementation of
Spliterator
that aggregates the elements of the stream based on a provided
Predicate
.- Author:
- Dominic Fox
- Modified by:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: AggregatingSpliterator.java 1060 2023-09-24 19:21:40Z tquadrat $
- Since:
- 0.0.7
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.stream.internal.AggregatingSpliterator"
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,
T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiPredicate
<List<I>, I> The predicate.The current slide.private final Spliterator
<I> The source.Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
Constructor Summary
ConstructorsConstructorDescriptionAggregatingSpliterator
(Spliterator<I> source, BiPredicate<List<I>, I> predicate) Creates a newAggregatingSpliterator
instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal int
final long
private boolean
isSameSlide
(I currentElement) Checks whether the current element is on the current slide.final boolean
tryAdvance
(Consumer<? super List<I>> action) final Spliterator
<List<I>> trySplit()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Spliterator
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
m_Condition
The predicate. -
m_CurrentSlide
The current slide. -
m_Source
The source.
-
-
Constructor Details
-
AggregatingSpliterator
Creates a newAggregatingSpliterator
instance.- Parameters:
source
- The source.predicate
- The predicate.
-
-
Method Details
-
characteristics
- Specified by:
characteristics
in interfaceSpliterator<I>
-
estimateSize
- Specified by:
estimateSize
in interfaceSpliterator<I>
-
isSameSlide
Checks whether the current element is on the current slide.- Parameters:
currentElement
- The current element.- Returns:
true
if the current element is on the current slide.
-
tryAdvance
- Specified by:
tryAdvance
in interfaceSpliterator<I>
-
trySplit
- Specified by:
trySplit
in interfaceSpliterator<I>
-