Class RepeatingResampler<C,V>
- java.lang.Object
-
- org.tensorics.core.tensor.resample.impl.RepeatingResampler<C,V>
-
- Type Parameters:
C
- the type of the coordinate in whos direction to resampleV
- 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 returntrue
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.
-
-
-
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 interfaceSingleDimensionResampler<C,V>
- Parameters:
coordinates
- the supporting points, which can be used as input to resamplevaluesCallback
- a function providing values of type V for all given coordinatescoordinate
- 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 returntrue
if the resampling will be possible, provided the the given parameters.- Specified by:
canResample
in interfaceSingleDimensionResampler<C,V>
- Parameters:
coordinates
- the supporting points, which can be used as input to resamplecoordinate
- the coordinate at which the resampling shall be performed- Returns:
true
if the resampling will be possible with the provided input,false
if not.
-
-