Class BiConvertedCursor<A,​B,​C>

    • Field Detail

      • converterSupplier

        protected final java.util.function.Supplier<BiConverter<? super A,​? super B,​? super C>> converterSupplier
      • converter

        protected final BiConverter<? super A,​? super B,​? super C> converter
      • sourceB

        protected final Cursor<B> sourceB
      • convertedSupplier

        protected final java.util.function.Supplier<? extends C> convertedSupplier
      • converted

        protected final C converted
    • Constructor Detail

      • BiConvertedCursor

        public BiConvertedCursor​(Cursor<A> sourceA,
                                 Cursor<B> sourceB,
                                 java.util.function.Supplier<BiConverter<? super A,​? super B,​? super C>> converterSupplier,
                                 java.util.function.Supplier<? extends C> convertedSupplier)
        Creates a copy of c for conversion that can be accessed through get().
      • BiConvertedCursor

        public BiConvertedCursor​(Cursor<A> sourceA,
                                 Cursor<B> sourceB,
                                 BiConverter<? super A,​? super B,​? super C> converter,
                                 java.util.function.Supplier<? extends C> convertedSupplier)
        Creates a copy of c for conversion that can be accessed through get().
    • Method Detail

      • get

        public C get()
        Description copied from interface: Sampler
        Access the actual T instance providing access to a pixel, sub-pixel or integral region value the Sampler points at.
      • getType

        public C getType()
        Description copied from interface: Typed
        Get an instance of T.

        It should not be assumed that the returned T instance is an independent copy. In particular, repeated calls to getType() may return the same instance.

        Returns:
        an instance of T
      • jumpFwd

        public void jumpFwd​(long steps)
        Description copied from interface: Iterator
        Move steps × forward.

        Highly recommended to override this with a more efficient version.

        Specified by:
        jumpFwd in interface Iterator
        Overrides:
        jumpFwd in class AbstractConvertedCursor<A,​C>
        Parameters:
        steps - number of steps to move forward
      • hasNext

        public boolean hasNext()
        The correct logic would be to return sourceA.hasNext() && sourceB.hasNext() but we test only sourceA for efficiency. Make sure that sourceA is the smaller IterableInterval.
        Specified by:
        hasNext in interface java.util.Iterator<A>
        Specified by:
        hasNext in interface Iterator
        Overrides:
        hasNext in class AbstractConvertedCursor<A,​C>
        Returns:
        true, if there is another step forward is possible, otherwise false
      • copy

        public BiConvertedCursor<A,​B,​C> copy()
        Specified by:
        copy in interface Cursor<A>
        Specified by:
        copy in interface RealCursor<A>
        Specified by:
        copy in interface Sampler<A>
        Specified by:
        copy in class AbstractConvertedCursor<A,​C>
        Returns:
        - A new Sampler in the same state accessing the same values. It does NOT copy T, just the state of the Sampler. Otherwise use T.copy() if available. Sampler.copy().get() == Sampler.get(), i.e. both hold the same value, not necessarily the same instance (this is the case for an ArrayCursor for example)