Class ImmutableNeatSelection<T extends Comparable<T>>

java.lang.Object
net.bmahe.genetics4j.neat.spec.selection.NeatSelection<T>
net.bmahe.genetics4j.neat.spec.selection.ImmutableNeatSelection<T>
All Implemented Interfaces:
SelectionPolicy

@Generated("org.immutables.processor.ProxyProcessor") public final class ImmutableNeatSelection<T extends Comparable<T>> extends NeatSelection<T>
Immutable implementation of NeatSelection.

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

  • Field Details

  • Constructor Details

  • Method Details

    • perSpeciesKeepRatio

      public float perSpeciesKeepRatio()
      Overrides:
      perSpeciesKeepRatio in class NeatSelection<T extends Comparable<T>>
      Returns:
      The value of the perSpeciesKeepRatio attribute
    • minSpeciesSize

      public int minSpeciesSize()
      Overrides:
      minSpeciesSize in class NeatSelection<T extends Comparable<T>>
      Returns:
      The value of the minSpeciesSize attribute
    • speciesPredicate

      public BiPredicate<Individual<T>,Individual<T>> speciesPredicate()
      Specified by:
      speciesPredicate in class NeatSelection<T extends Comparable<T>>
      Returns:
      The value of the speciesPredicate attribute
    • speciesSelection

      public SelectionPolicy speciesSelection()
      Specified by:
      speciesSelection in class NeatSelection<T extends Comparable<T>>
      Returns:
      The value of the speciesSelection attribute
    • withPerSpeciesKeepRatio

      public final ImmutableNeatSelection<T> withPerSpeciesKeepRatio(float value)
      Copy the current immutable object by setting a value for the perSpeciesKeepRatio attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for perSpeciesKeepRatio
      Returns:
      A modified copy of the this object
    • withMinSpeciesSize

      public final ImmutableNeatSelection<T> withMinSpeciesSize(int value)
      Copy the current immutable object by setting a value for the minSpeciesSize attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for minSpeciesSize
      Returns:
      A modified copy of the this object
    • withSpeciesPredicate

      public final ImmutableNeatSelection<T> withSpeciesPredicate(BiPredicate<Individual<T>,Individual<T>> value)
      Copy the current immutable object by setting a value for the speciesPredicate attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for speciesPredicate
      Returns:
      A modified copy of the this object
    • withSpeciesSelection

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

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

      public int hashCode()
      Computes a hash code from attributes: perSpeciesKeepRatio, minSpeciesSize, speciesPredicate, speciesSelection.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

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

      private static <T extends Comparable<T>> ImmutableNeatSelection<T> validate(ImmutableNeatSelection<T> instance)
    • copyOf

      public static <T extends Comparable<T>> ImmutableNeatSelection<T> copyOf(NeatSelection<T> instance)
      Creates an immutable copy of a NeatSelection value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Type Parameters:
      T - generic parameter T
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable NeatSelection instance