/*
 * Java Genetic Algorithm Library (@!identifier!@).
 * Copyright (c) @!year!@ Franz Wilhelmstötter
 *  
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Author:
 *     Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
 *     
 */
package org.jenetics;

import org.jenetics.util.Predicate;

/**
 * Some default GA termination strategies.
 * 
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @version $Id$
 */
public class Until {

	private Until() {
		throw new AssertionError("Don't create an 'Until' instance.");
	}
	
	static class Generation implements Predicate<Statistics<?, ?>> {
		private final int _generation;
		
		public Generation(final int generation) {
			_generation = generation;
		}
		
		@Override 
		public boolean evaluate(final Statistics<?, ?> statistics) {
			return statistics.getGeneration() < _generation;
		}		
	}
	
	public static Predicate<Statistics<?, ?>> Generation(final int generation) {
		return new Generation(generation);
	}
	
//	public static <G extends Gene<?, G>, C extends Comparable<? super C>> 
//	Predicate<Statistics<G, C>> valueOf()
//	{
//		return null;
//	}
	
}

@@ -1570,16 +1570,273 @@
 %09%09%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Return a %3Ci%3Etermination predicate%3C/i%3E which returns %7B@code false%7D if the%0A%09 * current GA generation is %7B@code %3E=%7D as the given %7B@code generation%7D.%0A%09 * ant %0A%09 * @param generation the maximal GA generation.%0A%09 * @return the termination predicate.%0A%09 */%0A
 %09public 

Add comments.