Package io.github.ai4ci.util
Class ImmutableEmpiricalDistribution.Builder
java.lang.Object
io.github.ai4ci.util.ImmutableEmpiricalDistribution.Builder
- Enclosing class:
- ImmutableEmpiricalDistribution
Builds instances of type
ImmutableEmpiricalDistribution
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableEmpiricalDistribution
.from
(EmpiricalDistribution instance) Fill a builder with attribute values from the providedEmpiricalDistribution
instance.setCumulativeProbability
(double... cumulativeProbability) Initializes the value for thecumulativeProbability
attribute.setMaximum
(double maximum) Initializes the value for themaximum
attribute.setMinimum
(double minimum) Initializes the value for theminimum
attribute.setX
(double... x) Initializes the value for thex
attribute.
-
Method Details
-
from
@CanIgnoreReturnValue public final ImmutableEmpiricalDistribution.Builder from(EmpiricalDistribution instance) Fill a builder with attribute values from the providedEmpiricalDistribution
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
setMinimum
@CanIgnoreReturnValue public final ImmutableEmpiricalDistribution.Builder setMinimum(double minimum) Initializes the value for theminimum
attribute.- Parameters:
minimum
- The value for minimum- Returns:
this
builder for use in a chained invocation
-
setMaximum
@CanIgnoreReturnValue public final ImmutableEmpiricalDistribution.Builder setMaximum(double maximum) Initializes the value for themaximum
attribute.- Parameters:
maximum
- The value for maximum- Returns:
this
builder for use in a chained invocation
-
setX
Initializes the value for thex
attribute.- Parameters:
x
- The elements for x- Returns:
this
builder for use in a chained invocation
-
setCumulativeProbability
@CanIgnoreReturnValue public final ImmutableEmpiricalDistribution.Builder setCumulativeProbability(double... cumulativeProbability) Initializes the value for thecumulativeProbability
attribute.- Parameters:
cumulativeProbability
- The elements for cumulativeProbability- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableEmpiricalDistribution
.- Returns:
- An immutable instance of EmpiricalDistribution
- Throws:
IllegalStateException
- if any required attributes are missing
-