Class ImmutablePartialMutation.Builder
java.lang.Object
net.bmahe.genetics4j.core.spec.mutation.ImmutablePartialMutation.Builder
- Enclosing class:
ImmutablePartialMutation
Builds instances of type
ImmutablePartialMutation
.
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
FieldsModifier and TypeFieldDescriptionprivate int
private static final long
private static final long
private long
private MutationPolicy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutablePartialMutation
.chromosomeIndex
(int chromosomeIndex) Initializes the value for thechromosomeIndex
attribute.private String
from
(PartialMutation instance) Fill a builder with attribute values from the providedPartialMutation
instance.mutationPolicy
(MutationPolicy mutationPolicy) Initializes the value for themutationPolicy
attribute.
-
Field Details
-
INIT_BIT_CHROMOSOME_INDEX
private static final long INIT_BIT_CHROMOSOME_INDEX- See Also:
-
INIT_BIT_MUTATION_POLICY
private static final long INIT_BIT_MUTATION_POLICY- See Also:
-
initBits
private long initBits -
chromosomeIndex
private int chromosomeIndex -
mutationPolicy
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedPartialMutation
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
-
chromosomeIndex
Initializes the value for thechromosomeIndex
attribute.- Parameters:
chromosomeIndex
- The value for chromosomeIndex- Returns:
this
builder for use in a chained invocation
-
mutationPolicy
Initializes the value for themutationPolicy
attribute.- Parameters:
mutationPolicy
- The value for mutationPolicy- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutablePartialMutation
.- Returns:
- An immutable instance of PartialMutation
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-