Class ImmutablePartialMutation

java.lang.Object
net.bmahe.genetics4j.core.spec.mutation.PartialMutation
net.bmahe.genetics4j.core.spec.mutation.ImmutablePartialMutation
All Implemented Interfaces:
MutationPolicy

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

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

  • Field Details

    • chromosomeIndex

      private final int chromosomeIndex
    • mutationPolicy

      private final MutationPolicy mutationPolicy
  • Constructor Details

    • ImmutablePartialMutation

      private ImmutablePartialMutation(int chromosomeIndex, MutationPolicy mutationPolicy)
    • ImmutablePartialMutation

      private ImmutablePartialMutation(ImmutablePartialMutation original, int chromosomeIndex, MutationPolicy mutationPolicy)
  • Method Details

    • chromosomeIndex

      public int chromosomeIndex()
      Specified by:
      chromosomeIndex in class PartialMutation
      Returns:
      The value of the chromosomeIndex attribute
    • mutationPolicy

      public MutationPolicy mutationPolicy()
      Specified by:
      mutationPolicy in class PartialMutation
      Returns:
      The value of the mutationPolicy attribute
    • withChromosomeIndex

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

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

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

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

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

      public static ImmutablePartialMutation of(int chromosomeIndex, MutationPolicy mutationPolicy)
      Construct a new immutable PartialMutation instance.
      Parameters:
      chromosomeIndex - The value for the chromosomeIndex attribute
      mutationPolicy - The value for the mutationPolicy attribute
      Returns:
      An immutable PartialMutation instance
    • validate

      private static ImmutablePartialMutation validate(ImmutablePartialMutation instance)
    • copyOf

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

      public static ImmutablePartialMutation.Builder builder()
      Creates a builder for ImmutablePartialMutation.
       ImmutablePartialMutation.builder()
          .chromosomeIndex(int) // required chromosomeIndex
          .mutationPolicy(net.bmahe.genetics4j.core.spec.mutation.MutationPolicy) // required mutationPolicy
          .build();
       
      Returns:
      A new ImmutablePartialMutation builder