Class DoubleStatistics.Builder

java.lang.Object
org.apache.commons.statistics.descriptive.DoubleStatistics.Builder
Enclosing class:
DoubleStatistics

public static final class DoubleStatistics.Builder extends Object
A builder for DoubleStatistics.
  • Field Details

    • NO_VALUES

      private static final double[] NO_VALUES
      An empty double array.
    • min

      private Function<double[],Min> min
      The Min constructor.
    • max

      private Function<double[],Max> max
      The Max constructor.
    • moment

      private BiFunction<org.apache.commons.numbers.core.Sum,double[],FirstMoment> moment
      The moment constructor. May return any instance of FirstMoment.
    • sum

      private Function<org.apache.commons.numbers.core.Sum,Sum> sum
      The Sum constructor.
    • product

      private Function<double[],Product> product
      The Product constructor.
    • sumOfSquares

      private Function<double[],SumOfSquares> sumOfSquares
      The SumOfSquares constructor.
    • sumOfLogs

      private Function<double[],SumOfLogs> sumOfLogs
      The SumOfLogs constructor.
    • momentOrder

      private int momentOrder
      The order of the moment. It corresponds to the power computed by the FirstMoment instance constructed by moment. This should only be increased from the default of zero (corresponding to no moment computation).
    • config

      private StatisticsConfiguration config
      Configuration options for computation of statistics.
  • Constructor Details

    • Builder

      Builder()
      Create an instance.
  • Method Details

    • add

      Add the statistic to the statistics to compute.
      Parameters:
      statistic - Statistic to compute.
      Returns:
      this instance
    • createMoment

      private void createMoment(int order)
      Creates the moment constructor for the specified order, e.g. order=2 is sum of squared deviations.
      Parameters:
      order - Order.
    • setConfiguration

      Sets the statistics configuration options for computation of statistics.
      Parameters:
      v - Value.
      Returns:
      the builder
      Throws:
      NullPointerException - if the value is null
    • build

      public DoubleStatistics build()
      Builds a DoubleStatistics instance.
      Returns:
      DoubleStatistics instance.
    • build

      public DoubleStatistics build(double... values)
      Builds a DoubleStatistics instance using the input values.

      Note: DoubleStatistics computed using accept may be different from this instance.

      Parameters:
      values - Values.
      Returns:
      DoubleStatistics instance.
    • create

      private static <S, T> T create(Function<S,T> constructor, S values)
      Creates the object from the values.
      Type Parameters:
      S - value type
      T - object type
      Parameters:
      constructor - Constructor.
      values - Values
      Returns:
      the instance
    • create

      private static <R, S, T> T create(BiFunction<R,S,T> constructor, R r, S s)
      Creates the object from the values r and s.
      Type Parameters:
      R - value type
      S - value type
      T - object type
      Parameters:
      constructor - Constructor.
      r - Value.
      s - Value.
      Returns:
      the instance