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>>
@Generated(from="ProportionalTournament",
generator="Immutables")
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
FieldsModifier and TypeFieldDescriptionprivate Comparator<Individual<T>> private static final longprivate static final longprivate static final longprivate static final longprivate longprivate intprivate doubleprivate Comparator<Individual<T>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newProportionalTournament.firstComparator(Comparator<Individual<T>> firstComparator) Initializes the value for thefirstComparatorattribute.private Stringfrom(ProportionalTournament<T> instance) Fill a builder with attribute values from the providedProportionalTournamentinstance.numCandidates(int numCandidates) Initializes the value for thenumCandidatesattribute.proportionFirst(double proportionFirst) Initializes the value for theproportionFirstattribute.secondComparator(Comparator<Individual<T>> secondComparator) Initializes the value for thesecondComparatorattribute.
-
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 providedProportionalTournamentinstance. 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:
thisbuilder for use in a chained invocation
-
numCandidates
Initializes the value for thenumCandidatesattribute.- Parameters:
numCandidates- The value for numCandidates- Returns:
thisbuilder for use in a chained invocation
-
proportionFirst
Initializes the value for theproportionFirstattribute.- Parameters:
proportionFirst- The value for proportionFirst- Returns:
thisbuilder for use in a chained invocation
-
firstComparator
public final ImmutableProportionalTournament.Builder<T> firstComparator(Comparator<Individual<T>> firstComparator) Initializes the value for thefirstComparatorattribute.- Parameters:
firstComparator- The value for firstComparator- Returns:
thisbuilder for use in a chained invocation
-
secondComparator
public final ImmutableProportionalTournament.Builder<T> secondComparator(Comparator<Individual<T>> secondComparator) Initializes the value for thesecondComparatorattribute.- Parameters:
secondComparator- The value for secondComparator- Returns:
thisbuilder 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
-