GeneConvergenceLimit implements Predicate<EvolutionResult<G, ?>> { @Override public boolean test(final EvolutionResult<G, ?> result) { final ISeq<DoubleMoments> stat = statistics(result.population()); return result.totalGenerations() <= 1 || stat.stream() .filter(_convergence) .count() <= _convergenceRate*stat.size(); } GeneConvergenceLimit(
		final Predicate<DoubleMoments> convergence,
		final double convergenceRate
	); @Override boolean test(final EvolutionResult<G, ?> result);  }
@Test(dataProvider = "limits") public void limit( final ISeq<Phenotype<DoubleGene, Double>> pop, final double geneConvergence, final double convergenceRage, final boolean proceed ) { final Predicate<EvolutionResult<DoubleGene, ?>> l = Limits.byGeneConvergence(geneConvergence, convergenceRage); Assert.assertEquals(l.test(result(pop)), proceed); }