Module io.jenetics.base
Package io.jenetics.internal.engine
Class EvolutionStreamImpl<G extends Gene<?,G>,C extends Comparable<? super C>>
java.lang.Object
io.jenetics.internal.util.StreamProxy<EvolutionResult<G,C>>
io.jenetics.internal.engine.EvolutionStreamImpl<G,C>
- All Implemented Interfaces:
EvolutionStream<G,,C> AutoCloseable,BaseStream<EvolutionResult<G,,C>, Stream<EvolutionResult<G, C>>> Stream<EvolutionResult<G,C>>
public final class EvolutionStreamImpl<G extends Gene<?,G>,C extends Comparable<? super C>>
extends StreamProxy<EvolutionResult<G,C>>
implements EvolutionStream<G,C>
- Since:
- 3.0
- Version:
- 5.1
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.stream.Stream
Stream.Builder<T extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionEvolutionStreamImpl(Supplier<EvolutionStart<G, C>> start, Evolution<G, C> evolution) EvolutionStreamImpl(Spliterator<EvolutionResult<G, C>> spliterator, boolean parallel) -
Method Summary
Modifier and TypeMethodDescriptionlimit(Predicate<? super EvolutionResult<G, C>> proceed) Returns a stream consisting of the elements of this stream, truncated when the givenproceedpredicate returnsfalse.static <G extends Gene<?,G>, C extends Comparable<? super C>>
EvolutionStreamImpl<G,C> of(Supplier<EvolutionStart<G, C>> start, Function<? super EvolutionStart<G, C>, ? extends Evolution<G, C>> evolution) Methods inherited from class io.jenetics.internal.util.StreamProxy
allMatch, anyMatch, close, collect, collect, count, distinct, dropWhile, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, isParallel, iterator, limit, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, onClose, parallel, peek, reduce, reduce, reduce, sequential, skip, sorted, sorted, spliterator, takeWhile, toArray, toArray, unorderedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.stream.BaseStream
close, isParallel, iterator, onClose, parallel, sequential, spliterator, unorderedMethods inherited from interface java.util.stream.Stream
allMatch, anyMatch, collect, collect, count, distinct, dropWhile, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, limit, map, mapMulti, mapMultiToDouble, mapMultiToInt, mapMultiToLong, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, peek, reduce, reduce, reduce, skip, sorted, sorted, takeWhile, toArray, toArray, toList
-
Constructor Details
-
EvolutionStreamImpl
-
EvolutionStreamImpl
-
-
Method Details
-
limit
Description copied from interface:EvolutionStreamReturns a stream consisting of the elements of this stream, truncated when the givenproceedpredicate returnsfalse.General usage example:
Note: The evolution result may befinal Phenotype<DoubleGene, Double> result = engine.stream() // Truncate the evolution stream after 5 "steady" generations. .limit(bySteadyFitness(5)) // The evolution will stop after maximal 100 generations. .limit(100) .collect(toBestPhenotype());null, if your truncation predicate returnsfalsefor the initial population.final EvolutionResult<DoubleGene, Double> result = engine.stream() .limit(er -> false) .collect(toBestEvolutionResult()); assert result == null;- Specified by:
limitin interfaceEvolutionStream<G extends Gene<?,G>, C extends Comparable<? super C>> - Parameters:
proceed- the predicate which determines whether the stream is truncated or not. If the predicate returnsfalse, the evolution stream is truncated.- Returns:
- the new stream
- See Also:
-
of
public static <G extends Gene<?,G>, EvolutionStreamImpl<G,C extends Comparable<? super C>> C> of(Supplier<EvolutionStart<G, C>> start, Function<? super EvolutionStart<G, C>, ? extends Evolution<G, C>> evolution)
-