Class ImmutableTournament.Builder<T extends Comparable<T>>
java.lang.Object
net.bmahe.genetics4j.core.spec.selection.ImmutableTournament.Builder<T>
- Direct Known Subclasses:
Tournament.Builder
- Enclosing class:
ImmutableTournament<T extends Comparable<T>>
@Generated(from="Tournament",
generator="Immutables")
public static class ImmutableTournament.Builder<T extends Comparable<T>>
extends Object
Builds instances of type
Tournament.
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 longprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newTournament.final Tournament.Builder<T> comparator(Comparator<Individual<T>> comparator) Initializes the value for thecomparatorattribute.private Stringfinal Tournament.Builder<T> from(Tournament<T> instance) Fill a builder with attribute values from the providedTournamentinstance.final Tournament.Builder<T> numCandidates(int numCandidates) Initializes the value for thenumCandidatesattribute.
-
Field Details
-
INIT_BIT_NUM_CANDIDATES
private static final long INIT_BIT_NUM_CANDIDATES- See Also:
-
initBits
private long initBits -
numCandidates
private int numCandidates -
comparator
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forTournamentinstances.new Tournament.Builder<T>() .numCandidates(int) // requirednumCandidates.comparator(Comparator<net.bmahe.genetics4j.core.Individual<T>>) // optionalcomparator.build();
-
-
Method Details
-
from
Fill a builder with attribute values from the providedTournamentinstance. 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
-
comparator
Initializes the value for thecomparatorattribute.If not set, this attribute will have a default value as returned by the initializer of
comparator.- Parameters:
comparator- The value for comparator- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newTournament.- Returns:
- An immutable instance of Tournament
- Throws:
IllegalStateException- if any required attributes are missing
-
formatRequiredAttributesMessage
-