Class ImmutableIntChromosomeSpec

java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.IntChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableIntChromosomeSpec
All Implemented Interfaces:
ChromosomeSpec

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

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

  • Field Details

    • size

      private final int size
    • minValue

      private final int minValue
    • maxValue

      private final int maxValue
  • Constructor Details

    • ImmutableIntChromosomeSpec

      private ImmutableIntChromosomeSpec(int size, int minValue, int maxValue)
  • Method Details

    • size

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

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

      public int maxValue()
      Specified by:
      maxValue in class IntChromosomeSpec
      Returns:
      The value of the maxValue attribute
    • withSize

      public final ImmutableIntChromosomeSpec 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 ImmutableIntChromosomeSpec withMinValue(int value)
      Copy the current immutable object by setting a value for the minValue attribute. A value equality check is 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 ImmutableIntChromosomeSpec withMaxValue(int value)
      Copy the current immutable object by setting a value for the maxValue attribute. A value equality check is 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
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableIntChromosomeSpec 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, ImmutableIntChromosomeSpec another)
    • hashCode

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

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

      public static ImmutableIntChromosomeSpec of(int size, int minValue, int maxValue)
      Construct a new immutable IntChromosomeSpec 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 IntChromosomeSpec instance
    • validate

      private static ImmutableIntChromosomeSpec validate(ImmutableIntChromosomeSpec instance)
    • copyOf

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