Class ImmutableDeleteNLast
java.lang.Object
net.bmahe.genetics4j.core.spec.replacement.ImmutableDeleteNLast
- All Implemented Interfaces:
DeleteNLast,ReplacementStrategy
@Generated(from="DeleteNLast",
generator="Immutables")
@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
Nested Classes -
Field Summary
FieldsFields inherited from interface net.bmahe.genetics4j.core.spec.replacement.DeleteNLast
DEFAULT_WEAK_RATIO -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateImmutableDeleteNLast(double weakRatio, SelectionPolicy offspringSelectionPolicy) privateprivateImmutableDeleteNLast(ImmutableDeleteNLast original, double weakRatio, SelectionPolicy offspringSelectionPolicy) -
Method Summary
Modifier and TypeMethodDescriptionstatic DeleteNLastcopyOf(DeleteNLast instance) Creates an immutable copy of aDeleteNLastvalue.booleanThis instance is equal to all instances ofImmutableDeleteNLastthat have equal attribute values.private booleanequalsByValue(ImmutableDeleteNLast another) inthashCode()Computes a hash code from attributes:weakRatio,offspringSelectionPolicy.static DeleteNLastof(double weakRatio, SelectionPolicy offspringSelectionPolicy) Construct a new immutableDeleteNLastinstance.Describe which offsprings to select for the next generationtoString()Prints the immutable valueDeleteNLastwith attribute values.private static ImmutableDeleteNLastvalidate(ImmutableDeleteNLast instance) doubleHow many weakest individuals to consider for replacementfinal ImmutableDeleteNLastCopy the current immutable object by setting a value for theoffspringSelectionPolicyattribute.final ImmutableDeleteNLastwithWeakRatio(double value) Copy the current immutable object by setting a value for theweakRatioattribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
weakRatioin interfaceDeleteNLast- Returns:
-
offspringSelectionPolicy
Describe which offsprings to select for the next generation- Specified by:
offspringSelectionPolicyin interfaceDeleteNLast- Returns:
-
withWeakRatio
Copy the current immutable object by setting a value for theweakRatioattribute. 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 or the
thisobject
-
withOffspringSelectionPolicy
Copy the current immutable object by setting a value for theoffspringSelectionPolicyattribute. 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 or the
thisobject
-
equals
This instance is equal to all instances ofImmutableDeleteNLastthat have equal attribute values. -
equalsByValue
-
hashCode
public int hashCode()Computes a hash code from attributes:weakRatio,offspringSelectionPolicy. -
toString
Prints the immutable valueDeleteNLastwith attribute values. -
of
Construct a new immutableDeleteNLastinstance.- Parameters:
weakRatio- The value for theweakRatioattributeoffspringSelectionPolicy- The value for theoffspringSelectionPolicyattribute- Returns:
- An immutable DeleteNLast instance
-
validate
-
copyOf
Creates an immutable copy of aDeleteNLastvalue. 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
-