Class ImmutableGenerationalReplacement.Builder
java.lang.Object
net.bmahe.genetics4j.core.spec.replacement.ImmutableGenerationalReplacement.Builder
- Direct Known Subclasses:
GenerationalReplacement.Builder
- Enclosing class:
ImmutableGenerationalReplacement
Builds instances of type
ImmutableGenerationalReplacement
.
Initialize attributes and then invoke the build()
method to create an
immutable instance.
Builder
is not thread-safe and generally should not be stored in a field or collection,
but instead used immediately to create instances.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableGenerationalReplacement
.private String
from
(GenerationalReplacement instance) Fill a builder with attribute values from the providedGenerationalReplacement
instance.offspringSelectionPolicy
(SelectionPolicy offspringSelectionPolicy) Initializes the value for theoffspringSelectionPolicy
attribute.
-
Field Details
-
INIT_BIT_OFFSPRING_SELECTION_POLICY
private static final long INIT_BIT_OFFSPRING_SELECTION_POLICY- See Also:
-
initBits
private long initBits -
offspringSelectionPolicy
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forImmutableGenerationalReplacement
instances.new GenerationalReplacement.Builder() .offspringSelectionPolicy(net.bmahe.genetics4j.core.spec.selection.SelectionPolicy) // required
offspringSelectionPolicy
.build();
-
-
Method Details
-
from
Fill a builder with attribute values from the providedGenerationalReplacement
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
offspringSelectionPolicy
public final GenerationalReplacement.Builder offspringSelectionPolicy(SelectionPolicy offspringSelectionPolicy) Initializes the value for theoffspringSelectionPolicy
attribute.- Parameters:
offspringSelectionPolicy
- The value for offspringSelectionPolicy- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableGenerationalReplacement
.- Returns:
- An immutable instance of GenerationalReplacement
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-