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.
See Also:
  • Field Details

    • iterators

      private final Spliterator<String>[] iterators
      The iterators over a single UTM zone.
    • index

      private int index
      Index of the current iterator.
    • upper

      private int upper
      Index 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.FactoryException
      org.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 for trySplit() method only.
  • Method Details

    • trySplit

      public Spliterator<String> 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:
      trySplit in interface Spliterator<String>
    • simplify

      final Spliterator<String> simplify()
      If this iterator is backed by only one worker iterator, returns that worker iterator. Otherwise returns this. 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:
      estimateSize in interface Spliterator<String>
    • tryAdvance

      public boolean tryAdvance(Consumer<? super String> action)
      Performs the given action on the remaining MGRS reference, if any.
      Specified by:
      tryAdvance in interface Spliterator<String>
    • forEachRemaining

      public void forEachRemaining(Consumer<? super String> action)
      Performs the given action on all remaining MGRS references.
      Specified by:
      forEachRemaining in interface Spliterator<String>
    • characteristics

      public int characteristics()
      Specifies that the list of elements is immutable, that all elements will be distinct and that this iterator never return null element.
      Specified by:
      characteristics in interface Spliterator<String>