Class ImmutableDeleteNLast

java.lang.Object
net.bmahe.genetics4j.core.spec.replacement.ImmutableDeleteNLast
All Implemented Interfaces:
DeleteNLast, ReplacementStrategy

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableDeleteNLast extends Object implements DeleteNLast
Immutable implementation of DeleteNLast.

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

  • Field Details

    • weakRatio

      private final double weakRatio
    • offspringSelectionPolicy

      private final SelectionPolicy offspringSelectionPolicy
  • Constructor Details

  • Method Details

    • weakRatio

      public double weakRatio()
      How many weakest individuals to consider for replacement
      Specified by:
      weakRatio in interface DeleteNLast
      Returns:
    • offspringSelectionPolicy

      public SelectionPolicy offspringSelectionPolicy()
      Describe which offsprings to select for the next generation
      Specified by:
      offspringSelectionPolicy in interface DeleteNLast
      Returns:
    • withWeakRatio

      public final ImmutableDeleteNLast withWeakRatio(double value)
      Copy the current immutable object by setting a value for the weakRatio attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for weakRatio
      Returns:
      A modified copy of the this object
    • withOffspringSelectionPolicy

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

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

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

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

      public static ImmutableDeleteNLast of(double weakRatio, SelectionPolicy offspringSelectionPolicy)
      Construct a new immutable DeleteNLast instance.
      Parameters:
      weakRatio - The value for the weakRatio attribute
      offspringSelectionPolicy - The value for the offspringSelectionPolicy attribute
      Returns:
      An immutable DeleteNLast instance
    • validate

      private static ImmutableDeleteNLast validate(ImmutableDeleteNLast instance)
    • copyOf

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