Interface NaNTransformer
-
- All Known Implementing Classes:
NaNTransformers.ErrorNaNTransformer
,NaNTransformers.ExcludeNaNTransformer
,NaNTransformers.IncludeNaNTransformer
interface NaNTransformer
Defines a transformer forNaN
values in arrays.This interface is not intended for a public API. It provides a consistent method to handle partial sorting of
double[]
data in theMedian
andQuantile
classes.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.0
istrue
and aNaN
value compares neither less than, greater than, nor equal to any value, even itself.The
Double.compare(double, double)
method imposes the ordering:-0.0
is treated as less than value0.0
andDouble.NaN
is considered greater than any other value and allDouble.NaN
values are considered equal.This interface allows implementations to respect the behaviour of
Double.compare(double, double)
, or implement different behaviour.- Since:
- 1.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description double[]
apply(double[] data, int[] bounds)
Pre-process the data for partitioning.
-
-
-
Method Detail
-
apply
double[] apply(double[] data, int[] bounds)
Pre-process the data for partitioning.This method will scan all the data and apply processing to
NaN
values.The method will return:
- An array to partition; this may be a copy.
- The
size
of the data; this can be smaller than the input array length if the transformer is configured to exclude NaN values.
- Parameters:
data
- Data.bounds
- [size].- Returns:
- pre-processed data (may be a copy)
-
-