Class ImmutableMultiPointCrossover

java.lang.Object
net.bmahe.genetics4j.core.spec.combination.MultiPointCrossover
net.bmahe.genetics4j.core.spec.combination.ImmutableMultiPointCrossover
All Implemented Interfaces:
CombinationPolicy

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

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

  • Field Details

    • numCrossovers

      private final int numCrossovers
  • Constructor Details

    • ImmutableMultiPointCrossover

      private ImmutableMultiPointCrossover(int numCrossovers)
  • Method Details

    • numCrossovers

      public int numCrossovers()
      Specified by:
      numCrossovers in class MultiPointCrossover
      Returns:
      The value of the numCrossovers attribute
    • withNumCrossovers

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

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

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

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

      public static ImmutableMultiPointCrossover of(int numCrossovers)
      Construct a new immutable MultiPointCrossover instance.
      Parameters:
      numCrossovers - The value for the numCrossovers attribute
      Returns:
      An immutable MultiPointCrossover instance
    • copyOf

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

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