Class ImmutableEmpiricalDistribution.Builder

java.lang.Object
io.github.ai4ci.util.ImmutableEmpiricalDistribution.Builder
Enclosing class:
ImmutableEmpiricalDistribution

@NotThreadSafe public static final class ImmutableEmpiricalDistribution.Builder extends Object
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 Details

    • from

      @CanIgnoreReturnValue public final ImmutableEmpiricalDistribution.Builder from(EmpiricalDistribution instance)
      Fill a builder with attribute values from the provided EmpiricalDistribution 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 the minimum 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 the maximum attribute.
      Parameters:
      maximum - The value for maximum
      Returns:
      this builder for use in a chained invocation
    • setX

      @CanIgnoreReturnValue public final ImmutableEmpiricalDistribution.Builder setX(double... x)
      Initializes the value for the x 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 the cumulativeProbability attribute.
      Parameters:
      cumulativeProbability - The elements for cumulativeProbability
      Returns:
      this builder for use in a chained invocation
    • build

      Returns:
      An immutable instance of EmpiricalDistribution
      Throws:
      IllegalStateException - if any required attributes are missing