Class RepeatingResampler<C,​V>

  • Type Parameters:
    C - the type of the coordinate in whos direction to resample
    V - the type of the tensor values
    All Implemented Interfaces:
    SingleDimensionResampler<C,​V>

    public class RepeatingResampler<C,​V>
    extends java.lang.Object
    implements SingleDimensionResampler<C,​V>
    Resampler that repeats values in one dimension. It requires a comparator for coordinates of the concerned dimension. If possible, values are repeated from the previous point. If the requested point is before the first point, then the value is 'repeated' from the next point.
    • Constructor Summary

      Constructors 
      Constructor Description
      RepeatingResampler​(java.util.Comparator<C> comparator)
      Constructs a new resampler, given a comparator for the relevant coordinates
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canResample​(java.util.Set<C> coordinates, C coordinate)
      Has to return true if the resampling will be possible, provided the the given parameters.
      V resample​(java.util.Set<C> coordinates, java.util.function.Function<C,​V> valuesCallback, C coordinate)
      Performs the actual resampling using the provided input.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RepeatingResampler

        public RepeatingResampler​(java.util.Comparator<C> comparator)
        Constructs a new resampler, given a comparator for the relevant coordinates
        Parameters:
        comparator - the comparator for the coordinates in question
    • Method Detail

      • resample

        public V resample​(java.util.Set<C> coordinates,
                          java.util.function.Function<C,​V> valuesCallback,
                          C coordinate)
        Description copied from interface: SingleDimensionResampler
        Performs the actual resampling using the provided input.
        Specified by:
        resample in interface SingleDimensionResampler<C,​V>
        Parameters:
        coordinates - the supporting points, which can be used as input to resample
        valuesCallback - a function providing values of type V for all given coordinates
        coordinate - the coordinate at which the resampling shall be performed
        Returns:
        true if the resampling will be possible with the provided input, false if not.
      • canResample

        public boolean canResample​(java.util.Set<C> coordinates,
                                   C coordinate)
        Description copied from interface: SingleDimensionResampler
        Has to return true if the resampling will be possible, provided the the given parameters.
        Specified by:
        canResample in interface SingleDimensionResampler<C,​V>
        Parameters:
        coordinates - the supporting points, which can be used as input to resample
        coordinate - the coordinate at which the resampling shall be performed
        Returns:
        true if the resampling will be possible with the provided input, false if not.