Class ImmutableRepeatedMutation

java.lang.Object
net.bmahe.genetics4j.core.spec.mutation.RepeatedMutation
net.bmahe.genetics4j.core.spec.mutation.ImmutableRepeatedMutation
All Implemented Interfaces:
MutationPolicy

@Generated(from="RepeatedMutation", generator="Immutables") @Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableRepeatedMutation extends RepeatedMutation
Immutable implementation of RepeatedMutation.

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

  • Field Details

    • minRepetitions

      private final int minRepetitions
    • maxRepetitions

      private final int maxRepetitions
    • mutationPolicy

      private final MutationPolicy mutationPolicy
  • Constructor Details

    • ImmutableRepeatedMutation

      private ImmutableRepeatedMutation(int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy)
    • ImmutableRepeatedMutation

      private ImmutableRepeatedMutation(ImmutableRepeatedMutation original, int minRepetitions, int maxRepetitions, MutationPolicy mutationPolicy)
  • Method Details

    • minRepetitions

      public int minRepetitions()
      Specified by:
      minRepetitions in class RepeatedMutation
      Returns:
      The value of the minRepetitions attribute
    • maxRepetitions

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

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

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

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

      public final ImmutableRepeatedMutation 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 or the this object
    • equals

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

      private boolean equalsByValue(ImmutableRepeatedMutation another)
    • hashCode

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

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

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

      private static ImmutableRepeatedMutation validate(ImmutableRepeatedMutation instance)
    • copyOf

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