Class ImmutableCSVEvolutionListener.Builder<T extends Comparable<T>,U>
java.lang.Object
net.bmahe.genetics4j.extras.evolutionlisteners.ImmutableCSVEvolutionListener.Builder<T,U>
- Direct Known Subclasses:
CSVEvolutionListener.Builder
- Enclosing class:
ImmutableCSVEvolutionListener<T extends Comparable<T>,U>
@Generated(from="CSVEvolutionListener",
generator="Immutables")
public static class ImmutableCSVEvolutionListener.Builder<T extends Comparable<T>,U>
extends Object
Builds instances of type
CSVEvolutionListener.
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 booleanprivate List<ColumnExtractor<T, U>> private GenerationFunction<T, U> private Stringprivate Function<Stream<EvolutionStep<T, U>>, Stream<EvolutionStep<T, U>>> private static final longprivate longprivate static final longprivate static final longprivate longprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal CSVEvolutionListener.Builder<T, U> addAllColumnExtractors(Iterable<? extends ColumnExtractor<T, U>> elements) Adds elements tocolumnExtractorslist.final CSVEvolutionListener.Builder<T, U> addColumnExtractors(ColumnExtractor<T, U> element) Adds one element tocolumnExtractorslist.final CSVEvolutionListener.Builder<T, U> addColumnExtractors(ColumnExtractor<T, U>... elements) Adds elements tocolumnExtractorslist.final CSVEvolutionListener.Builder<T, U> autoFlush(boolean autoFlush) Initializes the value for theautoFlushattribute.private booleanbuild()Builds a newCSVEvolutionListener.final CSVEvolutionListener.Builder<T, U> columnExtractors(Iterable<? extends ColumnExtractor<T, U>> elements) Sets or replaces all elements forcolumnExtractorslist.final CSVEvolutionListener.Builder<T, U> evolutionContextSupplier(GenerationFunction<T, U> evolutionContextSupplier) Initializes the value for theevolutionContextSupplierattribute.final CSVEvolutionListener.Builder<T, U> Initializes the value for thefilenameattribute.final CSVEvolutionListener.Builder<T, U> filter(Function<Stream<EvolutionStep<T, U>>, Stream<EvolutionStep<T, U>>> filter) Initializes the value for thefilterattribute.private Stringfinal CSVEvolutionListener.Builder<T, U> from(CSVEvolutionListener<T, U> instance) Fill a builder with attribute values from the providedCSVEvolutionListenerinstance.final CSVEvolutionListener.Builder<T, U> skipN(int skipN) Initializes the value for theskipNattribute.private boolean
-
Field Details
-
INIT_BIT_FILENAME
private static final long INIT_BIT_FILENAME- See Also:
-
OPT_BIT_AUTO_FLUSH
private static final long OPT_BIT_AUTO_FLUSH- See Also:
-
OPT_BIT_SKIP_N
private static final long OPT_BIT_SKIP_N- See Also:
-
initBits
private long initBits -
optBits
private long optBits -
autoFlush
private boolean autoFlush -
evolutionContextSupplier
-
skipN
private int skipN -
filter
private Function<Stream<EvolutionStep<T extends Comparable<T>,U>>, filterStream<EvolutionStep<T extends Comparable<T>, U>>> -
filename
-
columnExtractors
-
-
Constructor Details
-
Builder
public Builder()Creates a builder forCSVEvolutionListenerinstances.new CSVEvolutionListener.Builder<T, U>() .autoFlush(boolean) // optionalautoFlush.evolutionContextSupplier(net.bmahe.genetics4j.extras.evolutionlisteners.GenerationFunction<T, U>) // optionalevolutionContextSupplier.skipN(int) // optionalskipN.filter(function.Function<stream.Stream<net.bmahe.genetics4j.extras.evolutionlisteners.EvolutionStep<T, U>>, stream.Stream<net.bmahe.genetics4j.extras.evolutionlisteners.EvolutionStep<T, U>>>) // optionalfilter.filename(String) // requiredfilename.addColumnExtractors|addAllColumnExtractors(net.bmahe.genetics4j.extras.evolutionlisteners.ColumnExtractor<T, U>) //columnExtractorselements .build();
-
-
Method Details
-
from
Fill a builder with attribute values from the providedCSVEvolutionListenerinstance. 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
-
autoFlush
Initializes the value for theautoFlushattribute.If not set, this attribute will have a default value as returned by the initializer of
autoFlush.- Parameters:
autoFlush- The value for autoFlush- Returns:
thisbuilder for use in a chained invocation
-
evolutionContextSupplier
public final CSVEvolutionListener.Builder<T,U> evolutionContextSupplier(GenerationFunction<T, U> evolutionContextSupplier) Initializes the value for theevolutionContextSupplierattribute.If not set, this attribute will have a default value as returned by the initializer of
evolutionContextSupplier.- Parameters:
evolutionContextSupplier- The value for evolutionContextSupplier- Returns:
thisbuilder for use in a chained invocation
-
skipN
Initializes the value for theskipNattribute.If not set, this attribute will have a default value as returned by the initializer of
skipN.- Parameters:
skipN- The value for skipN- Returns:
thisbuilder for use in a chained invocation
-
filter
public final CSVEvolutionListener.Builder<T,U> filter(Function<Stream<EvolutionStep<T, U>>, Stream<EvolutionStep<T, U>>> filter) Initializes the value for thefilterattribute.If not set, this attribute will have a default value as returned by the initializer of
filter.- Parameters:
filter- The value for filter- Returns:
thisbuilder for use in a chained invocation
-
filename
Initializes the value for thefilenameattribute.- Parameters:
filename- The value for filename- Returns:
thisbuilder for use in a chained invocation
-
addColumnExtractors
Adds one element tocolumnExtractorslist.- Parameters:
element- A columnExtractors element- Returns:
thisbuilder for use in a chained invocation
-
addColumnExtractors
@SafeVarargs public final CSVEvolutionListener.Builder<T,U> addColumnExtractors(ColumnExtractor<T, U>... elements) Adds elements tocolumnExtractorslist.- Parameters:
elements- An array of columnExtractors elements- Returns:
thisbuilder for use in a chained invocation
-
columnExtractors
public final CSVEvolutionListener.Builder<T,U> columnExtractors(Iterable<? extends ColumnExtractor<T, U>> elements) Sets or replaces all elements forcolumnExtractorslist.- Parameters:
elements- An iterable of columnExtractors elements- Returns:
thisbuilder for use in a chained invocation
-
addAllColumnExtractors
public final CSVEvolutionListener.Builder<T,U> addAllColumnExtractors(Iterable<? extends ColumnExtractor<T, U>> elements) Adds elements tocolumnExtractorslist.- Parameters:
elements- An iterable of columnExtractors elements- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newCSVEvolutionListener.- Returns:
- An immutable instance of CSVEvolutionListener
- Throws:
IllegalStateException- if any required attributes are missing
-
autoFlushIsSet
private boolean autoFlushIsSet() -
skipNIsSet
private boolean skipNIsSet() -
formatRequiredAttributesMessage
-