Class BiConvertedCursor<A,B,C>

java.lang.Object
net.imglib2.converter.AbstractConvertedCursor<A,C>
net.imglib2.converter.read.BiConvertedCursor<A,B,C>
All Implemented Interfaces:
Iterator<C>, Cursor<C>, EuclideanSpace, Iterator, Localizable, RealCursor<C>, RealLocalizable, Sampler<C>, Typed<C>

public class BiConvertedCursor<A,B,C> extends AbstractConvertedCursor<A,C>
TODO
  • Field Details

    • converterSupplier

      protected final 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 Supplier<? extends C> convertedSupplier
    • converted

      protected final C converted
  • Constructor Details

    • BiConvertedCursor

      public BiConvertedCursor(Cursor<A> sourceA, Cursor<B> sourceB, Supplier<BiConverter<? super A, ? super B, ? super C>> converterSupplier, 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, Supplier<? extends C> convertedSupplier)
      Creates a copy of c for conversion that can be accessed through get().
  • Method Details

    • 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
    • fwd

      public void fwd()
      Description copied from interface: Iterator
      Move forward.
      Specified by:
      fwd in interface Iterator
      Overrides:
      fwd in class AbstractConvertedCursor<A,C>
    • reset

      public void reset()
      Description copied from interface: Iterator
      Reset the Iterator, that is put it to where it would be if newly created.
      Specified by:
      reset in interface Iterator
      Overrides:
      reset in class AbstractConvertedCursor<A,C>
    • 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 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
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<A>
      Overrides:
      remove in class AbstractConvertedCursor<A,C>
    • 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)