Package net.bmahe.genetics4j.core.spec
Class ImmutableEvolutionResult.Builder<T extends Comparable<T>>
java.lang.Object
net.bmahe.genetics4j.core.spec.ImmutableEvolutionResult.Builder<T>
- Enclosing class:
ImmutableEvolutionResult<T extends Comparable<T>>
@Generated(from="EvolutionResult",
generator="Immutables")
public static final class ImmutableEvolutionResult.Builder<T extends Comparable<T>>
extends Object
Builds instances of type
EvolutionResult.
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 AbstractEAConfiguration<T> private longprivate static final longprivate static final longprivate long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllFitness(Iterable<? extends T> elements) Adds elements tofitnesslist.addAllPopulation(Iterable<? extends Genotype> elements) Adds elements topopulationlist.addFitness(T element) Adds one element tofitnesslist.addFitness(T... elements) Adds elements tofitnesslist.addPopulation(Genotype element) Adds one element topopulationlist.addPopulation(Genotype... elements) Adds elements topopulationlist.build()Builds a newEvolutionResult.eaConfiguration(AbstractEAConfiguration<T> eaConfiguration) Initializes the value for theeaConfigurationattribute.Sets or replaces all elements forfitnesslist.private Stringfrom(EvolutionResult<T> instance) Fill a builder with attribute values from the providedEvolutionResultinstance.generation(long generation) Initializes the value for thegenerationattribute.population(Iterable<? extends Genotype> elements) Sets or replaces all elements forpopulationlist.
-
Field Details
-
INIT_BIT_EA_CONFIGURATION
private static final long INIT_BIT_EA_CONFIGURATION- See Also:
-
INIT_BIT_GENERATION
private static final long INIT_BIT_GENERATION- See Also:
-
initBits
private long initBits -
eaConfiguration
-
generation
private long generation -
population
-
fitness
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedEvolutionResultinstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
eaConfiguration
public final ImmutableEvolutionResult.Builder<T> eaConfiguration(AbstractEAConfiguration<T> eaConfiguration) Initializes the value for theeaConfigurationattribute.- Parameters:
eaConfiguration- The value for eaConfiguration- Returns:
thisbuilder for use in a chained invocation
-
generation
Initializes the value for thegenerationattribute.- Parameters:
generation- The value for generation- Returns:
thisbuilder for use in a chained invocation
-
addPopulation
Adds one element topopulationlist.- Parameters:
element- A population element- Returns:
thisbuilder for use in a chained invocation
-
addPopulation
Adds elements topopulationlist.- Parameters:
elements- An array of population elements- Returns:
thisbuilder for use in a chained invocation
-
population
Sets or replaces all elements forpopulationlist.- Parameters:
elements- An iterable of population elements- Returns:
thisbuilder for use in a chained invocation
-
addAllPopulation
public final ImmutableEvolutionResult.Builder<T> addAllPopulation(Iterable<? extends Genotype> elements) Adds elements topopulationlist.- Parameters:
elements- An iterable of population elements- Returns:
thisbuilder for use in a chained invocation
-
addFitness
Adds one element tofitnesslist.- Parameters:
element- A fitness element- Returns:
thisbuilder for use in a chained invocation
-
addFitness
Adds elements tofitnesslist.- Parameters:
elements- An array of fitness elements- Returns:
thisbuilder for use in a chained invocation
-
fitness
Sets or replaces all elements forfitnesslist.- Parameters:
elements- An iterable of fitness elements- Returns:
thisbuilder for use in a chained invocation
-
addAllFitness
Adds elements tofitnesslist.- Parameters:
elements- An iterable of fitness elements- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newEvolutionResult.- Returns:
- An immutable instance of EvolutionResult
- Throws:
IllegalStateException- if any required attributes are missing
-
formatRequiredAttributesMessage
-