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()
.
-
Nested Class Summary
-
Field Summary
Fields inherited from interface net.bmahe.genetics4j.core.spec.replacement.DeleteNLast
DEFAULT_WEAK_RATIO
-
Constructor Summary
ModifierConstructorDescriptionprivate
ImmutableDeleteNLast
(double weakRatio, SelectionPolicy offspringSelectionPolicy) private
private
ImmutableDeleteNLast
(ImmutableDeleteNLast original, double weakRatio, SelectionPolicy offspringSelectionPolicy) -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableDeleteNLast
copyOf
(DeleteNLast instance) Creates an immutable copy of aDeleteNLast
value.boolean
This instance is equal to all instances ofImmutableDeleteNLast
that have equal attribute values.private boolean
equalTo
(int synthetic, ImmutableDeleteNLast another) int
hashCode()
Computes a hash code from attributes:weakRatio
,offspringSelectionPolicy
.static ImmutableDeleteNLast
of
(double weakRatio, SelectionPolicy offspringSelectionPolicy) Construct a new immutableDeleteNLast
instance.Describe which offsprings to select for the next generationtoString()
Prints the immutable valueDeleteNLast
with attribute values.private static ImmutableDeleteNLast
validate
(ImmutableDeleteNLast instance) double
How many weakest individuals to consider for replacementfinal ImmutableDeleteNLast
Copy the current immutable object by setting a value for theoffspringSelectionPolicy
attribute.final ImmutableDeleteNLast
withWeakRatio
(double value) Copy the current immutable object by setting a value for theweakRatio
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.bmahe.genetics4j.core.spec.replacement.DeleteNLast
check
-
Field Details
-
weakRatio
private final double weakRatio -
offspringSelectionPolicy
-
-
Constructor Details
-
ImmutableDeleteNLast
-
ImmutableDeleteNLast
-
ImmutableDeleteNLast
private ImmutableDeleteNLast(ImmutableDeleteNLast original, double weakRatio, SelectionPolicy offspringSelectionPolicy)
-
-
Method Details
-
weakRatio
public double weakRatio()How many weakest individuals to consider for replacement- Specified by:
weakRatio
in interfaceDeleteNLast
- Returns:
-
offspringSelectionPolicy
Describe which offsprings to select for the next generation- Specified by:
offspringSelectionPolicy
in interfaceDeleteNLast
- Returns:
-
withWeakRatio
Copy the current immutable object by setting a value for theweakRatio
attribute. A value strict bits equality used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for weakRatio- Returns:
- A modified copy of the
this
object
-
withOffspringSelectionPolicy
Copy the current immutable object by setting a value for theoffspringSelectionPolicy
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for offspringSelectionPolicy- Returns:
- A modified copy of the
this
object
-
equals
This instance is equal to all instances ofImmutableDeleteNLast
that have equal attribute values. -
equalTo
-
hashCode
public int hashCode()Computes a hash code from attributes:weakRatio
,offspringSelectionPolicy
. -
toString
Prints the immutable valueDeleteNLast
with attribute values. -
of
Construct a new immutableDeleteNLast
instance.- Parameters:
weakRatio
- The value for theweakRatio
attributeoffspringSelectionPolicy
- The value for theoffspringSelectionPolicy
attribute- Returns:
- An immutable DeleteNLast instance
-
validate
-
copyOf
Creates an immutable copy of aDeleteNLast
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
-