Class ImmutableBitChromosomeSpec

java.lang.Object
net.bmahe.genetics4j.core.spec.chromosome.BitChromosomeSpec
net.bmahe.genetics4j.core.spec.chromosome.ImmutableBitChromosomeSpec
All Implemented Interfaces:
ChromosomeSpec

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

Use the builder to create immutable instances: ImmutableBitChromosomeSpec.builder(). Use the static factory method to create immutable instances: ImmutableBitChromosomeSpec.of().

  • Field Details

    • numBits

      private final int numBits
  • Constructor Details

    • ImmutableBitChromosomeSpec

      private ImmutableBitChromosomeSpec(int numBits)
  • Method Details

    • numBits

      public int numBits()
      Specified by:
      numBits in class BitChromosomeSpec
      Returns:
      The value of the numBits attribute
    • withNumBits

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

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

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

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

      public static ImmutableBitChromosomeSpec of(int numBits)
      Construct a new immutable BitChromosomeSpec instance.
      Parameters:
      numBits - The value for the numBits attribute
      Returns:
      An immutable BitChromosomeSpec instance
    • validate

      private static ImmutableBitChromosomeSpec validate(ImmutableBitChromosomeSpec instance)
    • copyOf

      public static ImmutableBitChromosomeSpec copyOf(BitChromosomeSpec instance)
      Creates an immutable copy of a BitChromosomeSpec 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 BitChromosomeSpec instance
    • builder

      public static ImmutableBitChromosomeSpec.Builder builder()
      Creates a builder for ImmutableBitChromosomeSpec.
       ImmutableBitChromosomeSpec.builder()
          .numBits(int) // required numBits
          .build();
       
      Returns:
      A new ImmutableBitChromosomeSpec builder