Interface NaNTransformer
-
- All Known Implementing Classes:
NaNTransformers.ErrorNaNTransformer,NaNTransformers.ExcludeNaNTransformer,NaNTransformers.IncludeNaNTransformer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface interface NaNTransformerDefines a transformer forNaNvalues in arrays.This interface is not intended for a public API. It provides a consistent method to handle partial sorting of
double[]data in theMedianandQuantileclasses.The transformer allows pre-processing floating-point data before applying a sort algorithm. This is required to handle
NaN.Note: The
<relation does not provide a total order on all double values:-0.0 == 0.0istrueand aNaNvalue compares neither less than, greater than, nor equal to any value, even itself.The
Double.compare(double, double)method imposes the ordering:-0.0is treated as less than value0.0andDouble.NaNis considered greater than any other value and allDouble.NaNvalues are considered equal.This interface allows implementations to respect the behaviour of
Double.compare(double, double), or implement different behaviour.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double[]apply(double[] data, int from, int to, int[] bounds)Pre-process the data for partitioning.
-
-
-
Method Detail
-
apply
double[] apply(double[] data, int from, int to, int[] bounds)Pre-process the data for partitioning.This method will scan all the data and apply processing to
NaNvalues.The method will return:
- An array to partition; this may be a copy.
- The
boundsof the returned data as [start, end); this can be smaller than the input range if the transformer is configured to exclude NaN values. The start is inclusive and the end is exclusive.
Implementations may assume the input
[from, to)range is valid given the length of thedataarray.- Parameters:
data- Data.from- Inclusive start of the range.to- Exclusive end of the range.bounds- Set to [start, end).- Returns:
- pre-processed data (may be a copy)
-
-