Class ImmutableGenerationalReplacement

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

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

Use the builder to create immutable instances: new GenerationalReplacement.Builder().

  • Field Details

    • offspringSelectionPolicy

      private final SelectionPolicy offspringSelectionPolicy
  • Constructor Details

    • ImmutableGenerationalReplacement

      private ImmutableGenerationalReplacement(SelectionPolicy offspringSelectionPolicy)
  • Method Details

    • offspringSelectionPolicy

      public SelectionPolicy offspringSelectionPolicy()
      Specified by:
      offspringSelectionPolicy in interface GenerationalReplacement
      Returns:
      The value of the offspringSelectionPolicy attribute
    • withOffspringSelectionPolicy

      public final ImmutableGenerationalReplacement 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 ImmutableGenerationalReplacement 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, ImmutableGenerationalReplacement another)
    • hashCode

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

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

      Creates an immutable copy of a GenerationalReplacement 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 GenerationalReplacement instance