public interface EvolutionStream<G extends Gene<?,G>,C extends Comparable<? super C>> extends Stream<EvolutionResult<G,C>>
EvolutionStream class extends the Java Stream and adds a
method for limiting the evolution by a given predicate.Stream,
EngineStream.Builder<T>| Modifier and Type | Method and Description |
|---|---|
EvolutionStream<G,C> |
limit(Predicate<? super EvolutionResult<G,C>> proceed)
Returns a stream consisting of the elements of this stream, truncated
when the given
proceed predicate returns false. |
allMatch, anyMatch, builder, collect, collect, concat, count, distinct, empty, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, generate, iterate, limit, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, of, of, peek, reduce, reduce, reduce, skip, sorted, sorted, toArray, toArrayclose, isParallel, iterator, onClose, parallel, sequential, spliterator, unorderedEvolutionStream<G,C> limit(Predicate<? super EvolutionResult<G,C>> proceed)
proceed predicate returns false.
General usage example:
final 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());proceed - the predicate which determines whether the stream is
truncated or not. If the predicate returns false, the
evolution stream is truncated.NullPointerException - if the given predicate is null.limit© 2007-2014 Franz Wilhelmstötter (2014-12-28 10:45)