Class ImmutableSimpleDistribution

java.lang.Object
io.github.ai4ci.util.ImmutableSimpleDistribution
All Implemented Interfaces:
Abstraction.Distribution, SimpleDistribution, Serializable

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableSimpleDistribution extends Object implements SimpleDistribution
Immutable implementation of SimpleDistribution.

Use the builder to create immutable instances: ImmutableSimpleDistribution.builder().

See Also:
  • Method Details

    • getType

      public SimpleDistribution.Type getType()
      Specified by:
      getType in interface SimpleDistribution
      Returns:
      The value of the type attribute
    • getCentral

      public double getCentral()
      Specified by:
      getCentral in interface Abstraction.Distribution
      Specified by:
      getCentral in interface SimpleDistribution
      Returns:
      The value of the central attribute
    • getDispersion

      @Nullable public Double getDispersion()
      Specified by:
      getDispersion in interface SimpleDistribution
      Returns:
      The value of the dispersion attribute
    • getSamples

      public double[] getSamples()
      Specified by:
      getSamples in interface SimpleDistribution
      Returns:
      The computed-at-construction value of the samples attribute
    • getMedian

      public double getMedian()
      Specified by:
      getMedian in interface Abstraction.Distribution
      Specified by:
      getMedian in interface SimpleDistribution
      Returns:
      The computed-at-construction value of the median attribute
    • withType

      Copy the current immutable object by setting a value for the type attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type
      Returns:
      A modified copy of the this object
    • withCentral

      public final ImmutableSimpleDistribution withCentral(double value)
      Copy the current immutable object by setting a value for the central attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for central
      Returns:
      A modified copy of the this object
    • withDispersion

      public final ImmutableSimpleDistribution withDispersion(@Nullable Double value)
      Copy the current immutable object by setting a value for the dispersion attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for dispersion (can be null)
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of ImmutableSimpleDistribution that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: type, central, dispersion, samples, median.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value SimpleDistribution with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableSimpleDistribution copyOf(SimpleDistribution instance)
      Creates an immutable copy of a SimpleDistribution value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable SimpleDistribution instance
    • toBuilder

      Creates a builder for ImmutableSimpleDistribution.prefilled with attibute values of this instance to easily create modified copies.
      Returns:
      A new ImmutableSimpleDistribution builder with attributes of this instance
    • builder

      public static ImmutableSimpleDistribution.Builder builder()
      Creates a builder for ImmutableSimpleDistribution.
       ImmutableSimpleDistribution.builder()
          .setType(io.github.ai4ci.util.SimpleDistribution.Type) // required type
          .setCentral(double) // required central
          .setDispersion(Double | null) // nullable dispersion
          .build();
       
      Returns:
      A new ImmutableSimpleDistribution builder