Class ImmutableDoubleTournament.Builder<T extends Comparable<T>>
java.lang.Object
net.bmahe.genetics4j.core.spec.selection.ImmutableDoubleTournament.Builder<T>
- Enclosing class:
ImmutableDoubleTournament<T extends Comparable<T>>
Builds instances of type
ImmutableDoubleTournament
.
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 boolean
private Tournament
<T> private static final long
private static final long
private static final long
private long
private static final long
private long
private Comparator
<Individual<T>> private double
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newImmutableDoubleTournament
.doFitnessFirst
(boolean doFitnessFirst) Initializes the value for thedoFitnessFirst
attribute.private boolean
fitnessTournament
(Tournament<T> fitnessTournament) Initializes the value for thefitnessTournament
attribute.private String
from
(DoubleTournament<T> instance) Fill a builder with attribute values from the providedDoubleTournament
instance.parsimonyComparator
(Comparator<Individual<T>> parsimonyComparator) Initializes the value for theparsimonyComparator
attribute.parsimonyTournamentSize
(double parsimonyTournamentSize) Initializes the value for theparsimonyTournamentSize
attribute.
-
Field Details
-
INIT_BIT_FITNESS_TOURNAMENT
private static final long INIT_BIT_FITNESS_TOURNAMENT- See Also:
-
INIT_BIT_PARSIMONY_COMPARATOR
private static final long INIT_BIT_PARSIMONY_COMPARATOR- See Also:
-
INIT_BIT_PARSIMONY_TOURNAMENT_SIZE
private static final long INIT_BIT_PARSIMONY_TOURNAMENT_SIZE- See Also:
-
OPT_BIT_DO_FITNESS_FIRST
private static final long OPT_BIT_DO_FITNESS_FIRST- See Also:
-
initBits
private long initBits -
optBits
private long optBits -
fitnessTournament
-
parsimonyComparator
-
parsimonyTournamentSize
private double parsimonyTournamentSize -
doFitnessFirst
private boolean doFitnessFirst
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedDoubleTournament
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
-
fitnessTournament
public final ImmutableDoubleTournament.Builder<T> fitnessTournament(Tournament<T> fitnessTournament) Initializes the value for thefitnessTournament
attribute.- Parameters:
fitnessTournament
- The value for fitnessTournament- Returns:
this
builder for use in a chained invocation
-
parsimonyComparator
public final ImmutableDoubleTournament.Builder<T> parsimonyComparator(Comparator<Individual<T>> parsimonyComparator) Initializes the value for theparsimonyComparator
attribute.- Parameters:
parsimonyComparator
- The value for parsimonyComparator- Returns:
this
builder for use in a chained invocation
-
parsimonyTournamentSize
public final ImmutableDoubleTournament.Builder<T> parsimonyTournamentSize(double parsimonyTournamentSize) Initializes the value for theparsimonyTournamentSize
attribute.- Parameters:
parsimonyTournamentSize
- The value for parsimonyTournamentSize- Returns:
this
builder for use in a chained invocation
-
doFitnessFirst
Initializes the value for thedoFitnessFirst
attribute.If not set, this attribute will have a default value as returned by the initializer of
doFitnessFirst
.- Parameters:
doFitnessFirst
- The value for doFitnessFirst- Returns:
this
builder for use in a chained invocation
-
build
Builds a newImmutableDoubleTournament
.- Returns:
- An immutable instance of DoubleTournament
- Throws:
IllegalStateException
- if any required attributes are missing
-
doFitnessFirstIsSet
private boolean doFitnessFirstIsSet() -
formatRequiredAttributesMessage
-