Class MilitaryGridReferenceSystem.Coder.IteratorAllZones
java.lang.Object
org.apache.sis.referencing.gazetteer.MilitaryGridReferenceSystem.Coder.IteratorAllZones
- All Implemented Interfaces:
Spliterator<String>
- Enclosing class:
- MilitaryGridReferenceSystem.Coder
private final class MilitaryGridReferenceSystem.Coder.IteratorAllZones
extends Object
implements Spliterator<String>
Iterator over the cells inside all UPS and UTM zones inside a given area of interest.
Each UPS or UTM zone is processed by a separated iterator, each of them with its own
MilitaryGridReferenceSystem.Encoder instance.-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,T_CONS extends Object, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intIndex of the current iterator.private final Spliterator<String>[]The iterators over a single UTM zone.private intIndex after the last iterator to return.Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCreates an iterator over the first half of the zones covered by the given iterator.(package private)IteratorAllZones(org.opengis.geometry.Envelope areaOfInterest) Creates a new iterator over MGRS cells in the given area of interest. -
Method Summary
Modifier and TypeMethodDescriptionintSpecifies that the list of elements is immutable, that all elements will be distinct and that this iterator never returnnullelement.longGuess the number of elements to be returned.voidforEachRemaining(Consumer<? super String> action) Performs the given action on all remaining MGRS references.(package private) final Spliterator<String>simplify()If this iterator is backed by only one worker iterator, returns that worker iterator.booleantryAdvance(Consumer<? super String> action) Performs the given action on the remaining MGRS reference, if any.trySplit()If this iterator can be partitioned, returns an iterator covering approximately the first half of MGRS references and update this iterator for covering the other half.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Spliterator
getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
iterators
The iterators over a single UTM zone. -
index
private int indexIndex of the current iterator. -
upper
private int upperIndex after the last iterator to return.
-
-
Constructor Details
-
IteratorAllZones
IteratorAllZones(org.opengis.geometry.Envelope areaOfInterest) throws org.opengis.util.FactoryException, org.opengis.referencing.operation.TransformException Creates a new iterator over MGRS cells in the given area of interest. The borders of the given envelope are considered exclusive.- Throws:
org.opengis.util.FactoryExceptionorg.opengis.referencing.operation.TransformException
-
IteratorAllZones
Creates an iterator over the first half of the zones covered by the given iterator. After construction, the given iterator will cover the second half. This constructor is fortrySplit()method only.
-
-
Method Details
-
trySplit
If this iterator can be partitioned, returns an iterator covering approximately the first half of MGRS references and update this iterator for covering the other half. Each iterator will use a disjoint set of projected CRS.- Specified by:
trySplitin interfaceSpliterator<String>
-
simplify
If this iterator is backed by only one worker iterator, returns that worker iterator. Otherwise returnsthis. This method should be invoked after construction. -
estimateSize
public long estimateSize()Guess the number of elements to be returned. The value returned by this method is very rough, and likely greater than the real amount of elements that will actually be returned.Note: returned value should be the number of remaining elements, but current implementation does not compute how many elements we have already traversed.
- Specified by:
estimateSizein interfaceSpliterator<String>
-
tryAdvance
Performs the given action on the remaining MGRS reference, if any.- Specified by:
tryAdvancein interfaceSpliterator<String>
-
forEachRemaining
Performs the given action on all remaining MGRS references.- Specified by:
forEachRemainingin interfaceSpliterator<String>
-
characteristics
public int characteristics()Specifies that the list of elements is immutable, that all elements will be distinct and that this iterator never returnnullelement.- Specified by:
characteristicsin interfaceSpliterator<String>
-