Class DoubleStatistics.Builder
java.lang.Object
org.apache.commons.statistics.descriptive.DoubleStatistics.Builder
- Enclosing class:
DoubleStatistics
A builder for
DoubleStatistics
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StatisticsConfiguration
Configuration options for computation of statistics.TheMax
constructor.TheMin
constructor.private BiFunction
<org.apache.commons.numbers.core.Sum, double[], FirstMoment> The moment constructor.private int
The order of the moment.private static final double[]
An empty double array.TheProduct
constructor.TheSum
constructor.TheSumOfLogs
constructor.private Function
<double[], SumOfSquares> TheSumOfSquares
constructor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) DoubleStatistics.Builder
Add the statistic to the statistics to compute.build()
Builds aDoubleStatistics
instance.build
(double... values) Builds aDoubleStatistics
instance using the inputvalues
.private static <R,
S, T> T create
(BiFunction<R, S, T> constructor, R r, S s) Creates the object from the valuesr
ands
.private static <S,
T> T Creates the object from thevalues
.private void
createMoment
(int order) Creates the moment constructor for the specifiedorder
, e.g.Sets the statistics configuration options for computation of statistics.
-
Field Details
-
NO_VALUES
private static final double[] NO_VALUESAn empty double array. -
min
TheMin
constructor. -
max
TheMax
constructor. -
moment
The moment constructor. May return any instance ofFirstMoment
. -
sum
TheSum
constructor. -
product
TheProduct
constructor. -
sumOfSquares
TheSumOfSquares
constructor. -
sumOfLogs
TheSumOfLogs
constructor. -
momentOrder
private int momentOrderThe order of the moment. It corresponds to the power computed by theFirstMoment
instance constructed bymoment
. This should only be increased from the default of zero (corresponding to no moment computation). -
config
Configuration options for computation of statistics.
-
-
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 specifiedorder
, e.g. order=2 is sum of squared deviations.- Parameters:
order
- Order.
-
setConfiguration
Sets the statistics configuration options for computation of statistics.- Parameters:
v
- Value.- Returns:
- the builder
- Throws:
NullPointerException
- if the value is null
-
build
Builds aDoubleStatistics
instance.- Returns:
DoubleStatistics
instance.
-
build
Builds aDoubleStatistics
instance using the inputvalues
.Note:
DoubleStatistics
computed usingaccept
may be different from this instance.- Parameters:
values
- Values.- Returns:
DoubleStatistics
instance.
-
create
Creates the object from thevalues
.- Type Parameters:
S
- value typeT
- object type- Parameters:
constructor
- Constructor.values
- Values- Returns:
- the instance
-
create
Creates the object from the valuesr
ands
.- Type Parameters:
R
- value typeS
- value typeT
- object type- Parameters:
constructor
- Constructor.r
- Value.s
- Value.- Returns:
- the instance
-