Class DoubleStatistics.Builder

    • Constructor Detail

      • Builder

        Builder()
        Create an instance.
    • Method Detail

      • add

        DoubleStatistics.Builder add​(Statistic statistic)
        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

        public DoubleStatistics.Builder setConfiguration​(StatisticsConfiguration v)
        Sets the statistics configuration options for computation of statistics.
        Parameters:
        v - Value.
        Returns:
        the builder
        Throws:
        java.lang.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.
      • build

        public DoubleStatistics build​(double[] values,
                                      int from,
                                      int to)
        Builds a DoubleStatistics instance using the specified range of values.

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

        Parameters:
        values - Values.
        from - Inclusive start of the range.
        to - Exclusive end of the range.
        Returns:
        DoubleStatistics instance.
        Throws:
        java.lang.IndexOutOfBoundsException - if the sub-range is out of bounds
        Since:
        1.2
      • create

        private DoubleStatistics create​(double[] values,
                                        int from,
                                        int to)
        Builds a DoubleStatistics instance using the input values.

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

        Warning: No range checks are performed.

        Parameters:
        values - Values.
        from - Inclusive start of the range.
        to - Exclusive end of the range.
        Returns:
        DoubleStatistics instance.
      • create

        private static <S,​T> T create​(java.util.function.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 <S,​T> T create​(RangeFunction<S,​T> constructor,
                                            S values,
                                            int from,
                                            int to)
        Creates the object from the values.
        Type Parameters:
        S - value type
        T - object type
        Parameters:
        constructor - Constructor.
        values - Values
        from - Inclusive start of the range.
        to - Exclusive end of the range.
        Returns:
        the instance
      • create

        private static <R,​S,​T> T create​(RangeBiFunction<R,​S,​T> constructor,
                                                    R r,
                                                    S s,
                                                    int from,
                                                    int to)
        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.
        from - Inclusive start of the range.
        to - Exclusive end of the range.
        Returns:
        the instance