Class LongStatistics.Builder

    • Constructor Detail

      • Builder

        Builder()
        Create an instance.
    • Method Detail

      • add

        LongStatistics.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 LongStatistics.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 LongStatistics build()
        Builds a LongStatistics instance.
        Returns:
        LongStatistics instance.
      • build

        public LongStatistics build​(long... values)
        Builds a LongStatistics instance using the input values.

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

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

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

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

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

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