Package io.github.ai4ci.util
Class ImmutableResampledDistribution.Builder
java.lang.Object
io.github.ai4ci.util.ImmutableResampledDistribution.Builder
- Enclosing class:
- ImmutableResampledDistribution
Builds instances of type
ImmutableResampledDistribution
.
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 newImmutableResampledDistribution
.from
(ResampledDistribution instance) Fill a builder with attribute values from the providedResampledDistribution
instance.setCombiner
(ModelOperation.BiFunction<Double, Double, Double> combiner) Initializes the value for thecombiner
attribute.setFirst
(Abstraction.Distribution first) Initializes the value for thefirst
attribute.setSecond
(Abstraction.Distribution second) Initializes the value for thesecond
attribute.
-
Method Details
-
from
@CanIgnoreReturnValue public final ImmutableResampledDistribution.Builder from(ResampledDistribution instance) Fill a builder with attribute values from the providedResampledDistribution
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
-
setFirst
@CanIgnoreReturnValue public final ImmutableResampledDistribution.Builder setFirst(Abstraction.Distribution first) Initializes the value for thefirst
attribute.- Parameters:
first
- The value for first- Returns:
this
builder for use in a chained invocation
-
setSecond
@CanIgnoreReturnValue public final ImmutableResampledDistribution.Builder setSecond(Abstraction.Distribution second) Initializes the value for thesecond
attribute.- Parameters:
second
- The value for second- Returns:
this
builder for use in a chained invocation
-
setCombiner
@CanIgnoreReturnValue public final ImmutableResampledDistribution.Builder setCombiner(ModelOperation.BiFunction<Double, Double, Double> combiner) Initializes the value for thecombiner
attribute.- Parameters:
combiner
- The value for combiner- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableResampledDistribution
.- Returns:
- An immutable instance of ResampledDistribution
- Throws:
IllegalStateException
- if any required attributes are missing
-