Class ImmutableDoubleChromosomeSpec

java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.DoubleChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableDoubleChromosomeSpec
All Implemented Interfaces:
ChromosomeSpec

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableDoubleChromosomeSpec extends DoubleChromosomeSpec
Immutable implementation of DoubleChromosomeSpec.

Use the builder to create immutable instances: new DoubleChromosomeSpec.Builder(). Use the static factory method to create immutable instances: ImmutableDoubleChromosomeSpec.of().

  • Field Details

    • size

      private final int size
    • minValue

      private final double minValue
    • maxValue

      private final double maxValue
    • distribution

      private final Distribution distribution
  • Constructor Details

    • ImmutableDoubleChromosomeSpec

      private ImmutableDoubleChromosomeSpec(int size, double minValue, double maxValue)
    • ImmutableDoubleChromosomeSpec

      private ImmutableDoubleChromosomeSpec(ImmutableDoubleChromosomeSpec.Builder builder)
    • ImmutableDoubleChromosomeSpec

      private ImmutableDoubleChromosomeSpec(int size, double minValue, double maxValue, Distribution distribution)
  • Method Details

    • size

      public int size()
      Specified by:
      size in class DoubleChromosomeSpec
      Returns:
      The value of the size attribute
    • minValue

      public double minValue()
      Specified by:
      minValue in class DoubleChromosomeSpec
      Returns:
      The value of the minValue attribute
    • maxValue

      public double maxValue()
      Specified by:
      maxValue in class DoubleChromosomeSpec
      Returns:
      The value of the maxValue attribute
    • distribution

      public Distribution distribution()
      Overrides:
      distribution in class DoubleChromosomeSpec
      Returns:
      The value of the distribution attribute
    • withSize

      public final ImmutableDoubleChromosomeSpec withSize(int value)
      Copy the current immutable object by setting a value for the size attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for size
      Returns:
      A modified copy of the this object
    • withMinValue

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

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

      public final ImmutableDoubleChromosomeSpec withDistribution(Distribution value)
      Copy the current immutable object by setting a value for the distribution attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for distribution
      Returns:
      A modified copy of the this object
    • equals

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

      private boolean equalTo(int synthetic, ImmutableDoubleChromosomeSpec another)
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: size, minValue, maxValue, distribution.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      public static ImmutableDoubleChromosomeSpec of(int size, double minValue, double maxValue)
      Construct a new immutable DoubleChromosomeSpec instance.
      Parameters:
      size - The value for the size attribute
      minValue - The value for the minValue attribute
      maxValue - The value for the maxValue attribute
      Returns:
      An immutable DoubleChromosomeSpec instance
    • validate

    • copyOf

      public static ImmutableDoubleChromosomeSpec copyOf(DoubleChromosomeSpec instance)
      Creates an immutable copy of a DoubleChromosomeSpec 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 DoubleChromosomeSpec instance