Class ImmutableNeatCombination.Builder
java.lang.Object
net.bmahe.genetics4j.neat.spec.combination.ImmutableNeatCombination.Builder
- Direct Known Subclasses:
NeatCombination.Builder
- Enclosing class:
ImmutableNeatCombination
Builds instances of type
ImmutableNeatCombination
.
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
Modifier and TypeFieldDescriptionprivate double
private static final long
private static final long
private long
private ParentComparisonPolicy
private double
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableNeatCombination
.final NeatCombination.Builder
from
(NeatCombination instance) Fill a builder with attribute values from the providedNeatCombination
instance.final NeatCombination.Builder
inheritanceThresold
(double inheritanceThresold) Initializes the value for theinheritanceThresold
attribute.private boolean
final NeatCombination.Builder
parentComparisonPolicy
(ParentComparisonPolicy parentComparisonPolicy) Initializes the value for theparentComparisonPolicy
attribute.final NeatCombination.Builder
reenableGeneInheritanceThresold
(double reenableGeneInheritanceThresold) Initializes the value for thereenableGeneInheritanceThresold
attribute.private boolean
-
Field Details
-
OPT_BIT_INHERITANCE_THRESOLD
private static final long OPT_BIT_INHERITANCE_THRESOLD- See Also:
-
OPT_BIT_REENABLE_GENE_INHERITANCE_THRESOLD
private static final long OPT_BIT_REENABLE_GENE_INHERITANCE_THRESOLD- See Also:
-
optBits
private long optBits -
inheritanceThresold
private double inheritanceThresold -
reenableGeneInheritanceThresold
private double reenableGeneInheritanceThresold -
parentComparisonPolicy
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forImmutableNeatCombination
instances.new NeatCombination.Builder() .inheritanceThresold(double) // optional
inheritanceThresold
.reenableGeneInheritanceThresold(double) // optionalreenableGeneInheritanceThresold
.parentComparisonPolicy(net.bmahe.genetics4j.neat.spec.combination.parentcompare.ParentComparisonPolicy) // optionalparentComparisonPolicy
.build();
-
-
Method Details
-
from
Fill a builder with attribute values from the providedNeatCombination
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
-
inheritanceThresold
Initializes the value for theinheritanceThresold
attribute.If not set, this attribute will have a default value as returned by the initializer of
inheritanceThresold
.- Parameters:
inheritanceThresold
- The value for inheritanceThresold- Returns:
this
builder for use in a chained invocation
-
reenableGeneInheritanceThresold
public final NeatCombination.Builder reenableGeneInheritanceThresold(double reenableGeneInheritanceThresold) Initializes the value for thereenableGeneInheritanceThresold
attribute.If not set, this attribute will have a default value as returned by the initializer of
reenableGeneInheritanceThresold
.- Parameters:
reenableGeneInheritanceThresold
- The value for reenableGeneInheritanceThresold- Returns:
this
builder for use in a chained invocation
-
parentComparisonPolicy
public final NeatCombination.Builder parentComparisonPolicy(ParentComparisonPolicy parentComparisonPolicy) Initializes the value for theparentComparisonPolicy
attribute.If not set, this attribute will have a default value as returned by the initializer of
parentComparisonPolicy
.- Parameters:
parentComparisonPolicy
- The value for parentComparisonPolicy- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableNeatCombination
.- Returns:
- An immutable instance of NeatCombination
- Throws:
IllegalStateException
- if any required attributes are missing
-
inheritanceThresoldIsSet
private boolean inheritanceThresoldIsSet() -
reenableGeneInheritanceThresoldIsSet
private boolean reenableGeneInheritanceThresoldIsSet()
-