Class ImmutableTarpeianMethod.Builder
java.lang.Object
net.bmahe.genetics4j.gp.postevaluationprocess.ImmutableTarpeianMethod.Builder
- Enclosing class:
ImmutableTarpeianMethod
Builds instances of type
ImmutableTarpeianMethod
.
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 static final long
private static final long
private static final long
private static final long
private long
private double
private double
private RandomGenerator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableTarpeianMethod
.private String
from
(TarpeianMethod instance) Fill a builder with attribute values from the providedTarpeianMethod
instance.newValue
(double newValue) Initializes the value for thenewValue
attribute.probability
(double probability) Initializes the value for theprobability
attribute.randomGenerator
(RandomGenerator randomGenerator) Initializes the value for therandomGenerator
attribute.sizeFunction
(Function<Genotype, Integer> sizeFunction) Initializes the value for thesizeFunction
attribute.
-
Field Details
-
INIT_BIT_RANDOM_GENERATOR
private static final long INIT_BIT_RANDOM_GENERATOR- See Also:
-
INIT_BIT_SIZE_FUNCTION
private static final long INIT_BIT_SIZE_FUNCTION- See Also:
-
INIT_BIT_PROBABILITY
private static final long INIT_BIT_PROBABILITY- See Also:
-
INIT_BIT_NEW_VALUE
private static final long INIT_BIT_NEW_VALUE- See Also:
-
initBits
private long initBits -
randomGenerator
-
sizeFunction
-
probability
private double probability -
newValue
private double newValue
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedTarpeianMethod
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
-
randomGenerator
Initializes the value for therandomGenerator
attribute.- Parameters:
randomGenerator
- The value for randomGenerator- Returns:
this
builder for use in a chained invocation
-
sizeFunction
Initializes the value for thesizeFunction
attribute.- Parameters:
sizeFunction
- The value for sizeFunction- Returns:
this
builder for use in a chained invocation
-
probability
Initializes the value for theprobability
attribute.- Parameters:
probability
- The value for probability- Returns:
this
builder for use in a chained invocation
-
newValue
Initializes the value for thenewValue
attribute.- Parameters:
newValue
- The value for newValue- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableTarpeianMethod
.- Returns:
- An immutable instance of TarpeianMethod
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-