Class ImmutableProportionalTournament.Builder<T extends Comparable<T>>
java.lang.Object
net.bmahe.genetics4j.core.spec.selection.ImmutableProportionalTournament.Builder<T>
- Enclosing class:
ImmutableProportionalTournament<T extends Comparable<T>>
public static final class ImmutableProportionalTournament.Builder<T extends Comparable<T>>
extends Object
Builds instances of type
ProportionalTournament
.
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 Comparator
<Individual<T>> private static final long
private static final long
private static final long
private static final long
private long
private int
private double
private Comparator
<Individual<T>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newProportionalTournament
.firstComparator
(Comparator<Individual<T>> firstComparator) Initializes the value for thefirstComparator
attribute.private String
from
(ProportionalTournament<T> instance) Fill a builder with attribute values from the providedProportionalTournament
instance.numCandidates
(int numCandidates) Initializes the value for thenumCandidates
attribute.proportionFirst
(double proportionFirst) Initializes the value for theproportionFirst
attribute.secondComparator
(Comparator<Individual<T>> secondComparator) Initializes the value for thesecondComparator
attribute.
-
Field Details
-
INIT_BIT_NUM_CANDIDATES
private static final long INIT_BIT_NUM_CANDIDATES- See Also:
-
INIT_BIT_PROPORTION_FIRST
private static final long INIT_BIT_PROPORTION_FIRST- See Also:
-
INIT_BIT_FIRST_COMPARATOR
private static final long INIT_BIT_FIRST_COMPARATOR- See Also:
-
INIT_BIT_SECOND_COMPARATOR
private static final long INIT_BIT_SECOND_COMPARATOR- See Also:
-
initBits
private long initBits -
numCandidates
private int numCandidates -
proportionFirst
private double proportionFirst -
firstComparator
-
secondComparator
-
-
Constructor Details
-
Builder
private Builder()
-
-
Method Details
-
from
Fill a builder with attribute values from the providedProportionalTournament
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
-
numCandidates
Initializes the value for thenumCandidates
attribute.- Parameters:
numCandidates
- The value for numCandidates- Returns:
this
builder for use in a chained invocation
-
proportionFirst
Initializes the value for theproportionFirst
attribute.- Parameters:
proportionFirst
- The value for proportionFirst- Returns:
this
builder for use in a chained invocation
-
firstComparator
public final ImmutableProportionalTournament.Builder<T> firstComparator(Comparator<Individual<T>> firstComparator) Initializes the value for thefirstComparator
attribute.- Parameters:
firstComparator
- The value for firstComparator- Returns:
this
builder for use in a chained invocation
-
secondComparator
public final ImmutableProportionalTournament.Builder<T> secondComparator(Comparator<Individual<T>> secondComparator) Initializes the value for thesecondComparator
attribute.- Parameters:
secondComparator
- The value for secondComparator- Returns:
this
builder for use in a chained invocation
-
build
Builds a newProportionalTournament
.- Returns:
- An immutable instance of ProportionalTournament
- Throws:
IllegalStateException
- if any required attributes are missing
-
formatRequiredAttributesMessage
-