Class IntStatistics.Builder

  • Enclosing class:
    IntStatistics

    public static final class IntStatistics.Builder
    extends java.lang.Object
    A builder for IntStatistics.
    • Constructor Detail

      • Builder

        Builder()
        Create an instance.
    • Method Detail

      • add

        IntStatistics.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=3 is sum of cubed deviations.
        Parameters:
        order - Order.
      • setConfiguration

        public IntStatistics.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 IntStatistics build()
        Builds an IntStatistics instance.
        Returns:
        IntStatistics instance.
      • build

        public IntStatistics build​(int... values)
        Builds an IntStatistics instance using the input values.

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

        Parameters:
        values - Values.
        Returns:
        IntStatistics instance.
      • build

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

        Note: IntStatistics 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:
        IntStatistics instance.
        Throws:
        java.lang.IndexOutOfBoundsException - if the sub-range is out of bounds
        Since:
        1.2
      • create

        private IntStatistics create​(int[] values,
                                     int from,
                                     int to)
        Builds an IntStatistics instance using the input values.

        Note: IntStatistics 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:
        IntStatistics 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