Class FloatBigSpliterators.LateBindingSizeIndexBasedSpliterator
- All Implemented Interfaces:
it.unimi.dsi.fastutil.floats.FloatSpliterator,Spliterator<Float>,Spliterator.OfPrimitive<Float,it.unimi.dsi.fastutil.floats.FloatConsumer, it.unimi.dsi.fastutil.floats.FloatSpliterator>
- Enclosing class:
FloatBigSpliterators
This class implements a late binding strategy. On a new, non-split instance, the
max pos will track the given data store (usually it's
size, hence the class' name). On the first
split, the last index will be read from the backing data store one
last time and then be fixed for the remaining duration of this instance.
The returned split should should also be have a constant maxPos.
As the abstract methods in this class are used in inner loops, it is generally a
good idea to override the class as final as to encourage the JVM to inline
them (or alternatively, override the abstract methods as final).
-
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 TypeFieldDescriptionprotected longThe maximumFloatBigSpliterators.AbstractIndexBasedSpliterator.poscan be, or -1 if it hasn't been fixed yet.Fields inherited from class it.unimi.dsi.fastutil.floats.FloatBigSpliterators.AbstractIndexBasedSpliterator
posFields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLateBindingSizeIndexBasedSpliterator(long initialPos) protectedLateBindingSizeIndexBasedSpliterator(long initialPos, long fixedMaxPos) -
Method Summary
Modifier and TypeMethodDescriptionprotected final longThe maximum pos can be, and is the logical end (exclusive) of the "range".protected abstract longReturn the maximum pos can be dynamically tracking the backing data store.it.unimi.dsi.fastutil.floats.FloatSpliteratortrySplit()Methods inherited from class it.unimi.dsi.fastutil.floats.FloatBigSpliterators.AbstractIndexBasedSpliterator
characteristics, computeSplitPoint, estimateSize, forEachRemaining, get, makeForSplit, skip, tryAdvanceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.unimi.dsi.fastutil.floats.FloatSpliterator
forEachRemaining, getComparator, tryAdvanceMethods inherited from interface java.util.Spliterator
getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
maxPos
protected long maxPosThe maximumFloatBigSpliterators.AbstractIndexBasedSpliterator.poscan be, or -1 if it hasn't been fixed yet.
-
-
Constructor Details
-
LateBindingSizeIndexBasedSpliterator
protected LateBindingSizeIndexBasedSpliterator(long initialPos) -
LateBindingSizeIndexBasedSpliterator
protected LateBindingSizeIndexBasedSpliterator(long initialPos, long fixedMaxPos)
-
-
Method Details
-
getMaxPosFromBackingStore
protected abstract long getMaxPosFromBackingStore()Return the maximum pos can be dynamically tracking the backing data store.This method will be the return value of
getMaxPos()until this spliterator is trySplit() split, in which case its final return value will be saved and remain constant for the rest of the duration of this instance. -
getMaxPos
protected final long getMaxPos()Description copied from class:FloatBigSpliterators.AbstractIndexBasedSpliteratorThe maximum pos can be, and is the logical end (exclusive) of the "range".If pos is equal to the return of this method, this means the last element has been returned and the next call to
FloatBigSpliterators.AbstractIndexBasedSpliterator.tryAdvance(it.unimi.dsi.fastutil.floats.FloatConsumer)will returnfalse.Usually set return the parent collection's size, but does not have to be (for example, sublists and subranges).
This method allows the implementation to decide how it binds on the size (late or early). However,
FloatBigSpliterators.EarlyBindingSizeIndexBasedSpliteratorandFloatBigSpliterators.LateBindingSizeIndexBasedSpliteratorgive an implementation of this method for the two most common strategies.- Specified by:
getMaxPosin classFloatBigSpliterators.AbstractIndexBasedSpliterator
-
trySplit
public it.unimi.dsi.fastutil.floats.FloatSpliterator trySplit()Description copied from class:FloatBigSpliterators.AbstractIndexBasedSpliterator- Specified by:
trySplitin interfaceit.unimi.dsi.fastutil.floats.FloatSpliterator- Specified by:
trySplitin interfaceSpliterator<Float>- Specified by:
trySplitin interfaceSpliterator.OfPrimitive<Float,it.unimi.dsi.fastutil.floats.FloatConsumer, it.unimi.dsi.fastutil.floats.FloatSpliterator> - Overrides:
trySplitin classFloatBigSpliterators.AbstractIndexBasedSpliterator
-