Class LongStatistics.Builder

    • Field Detail

      • NO_VALUES

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

        private java.util.function.Function<long[],​LongMin> min
        The LongMin constructor.
      • max

        private java.util.function.Function<long[],​LongMax> max
        The LongMax constructor.
      • moment

        private java.util.function.Function<long[],​FirstMoment> moment
        The moment constructor. May return any instance of FirstMoment.
      • sum

        private java.util.function.Function<long[],​LongSum> sum
        The LongSum constructor.
      • product

        private java.util.function.Function<long[],​Product> product
        The Product constructor.
      • sumOfLogs

        private java.util.function.Function<long[],​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).
    • 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.
      • create

        private static <T> T create​(java.util.function.Function<long[],​T> constructor,
                                    long[] values)
        Creates the object from the values.
        Type Parameters:
        T - object type
        Parameters:
        constructor - Constructor.
        values - Values
        Returns:
        the instance