Class IntStatistics.Builder

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

public static final class IntStatistics.Builder extends Object
A builder for IntStatistics.
Since:
1.1
  • Field Details

  • 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=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:
      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:
      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