Class NaNTransformers.IncludeNaNTransformer

java.lang.Object
org.apache.commons.statistics.descriptive.NaNTransformers.IncludeNaNTransformer
All Implemented Interfaces:
NaNTransformer
Enclosing class:
NaNTransformers

private static final class NaNTransformers.IncludeNaNTransformer extends Object implements NaNTransformer
A NaN transformer that optionally copies the data. No NaN processing is done as it is assumed that downstream sorting will move NaN to the end of the data.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
    Set to true to use a copy of the data.
  • Constructor Summary

    Constructors
    Constructor
    Description
    IncludeNaNTransformer(boolean copy)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double[]
    apply(double[] data, int from, int to, int[] bounds)
    Pre-process the data for partitioning.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • copy

      private final boolean copy
      Set to true to use a copy of the data.
  • Constructor Details

    • IncludeNaNTransformer

      IncludeNaNTransformer(boolean copy)
      Parameters:
      copy - Set to true to use a copy of the data.
  • Method Details

    • apply

      public double[] apply(double[] data, int from, int to, int[] bounds)
      Description copied from interface: NaNTransformer
      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 bounds of 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 the data array.

      Specified by:
      apply in interface NaNTransformer
      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)