/*
 * Java Genetic Algorithm Library (@__identifier__@).
 * Copyright (c) @__year__@ Franz Wilhelmstötter
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author:
 *    Franz Wilhelmstötter (franz.wilhelmstoetter@gmail.com)
 */
package io.jenetics.engine;

import java.util.function.Function;

import io.jenetics.Gene;
import io.jenetics.Genotype;

/**
 * This interface extends the {@link Codec} and allows to encode an object from
 * the problem space to a corresponding {@link Genotype}.
 *
 * @param <T> the argument type of a given problem
 * @param <G> the {@code Gene} type used for encoding the argument type {@code T}
 *
 * @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
 * @version !__version__!
 * @since !__version__!
 */
public interface Encodec<T, G extends Gene<?, G>> extends Codec<T, G> {

	public Function<T, Genotype<G>> encoder();

	public default Genotype<G> encode(final T value) {
		return encoder().apply(value);
	}

}

@@ -766,16 +766,65 @@
 ngine;%0A%0A
+import static java.util.Objects.requireNonNull;%0A%0A
 import j
@@ -851,16 +851,16 @@
 nction;%0A
-
 %0Aimport 
@@ -905,16 +905,49 @@
 enotype;
+%0Aimport io.jenetics.util.Factory;
 %0A%0A/**%0A *
@@ -1530,16 +1530,16 @@
 alue) %7B%0A
-
 %09%09return
@@ -1567,10 +1567,574 @@
 e);%0A%09%7D%0A%0A
+%09public static %3CT, G extends Gene%3C?, G%3E%3E Encodec%3CT, G%3E of(%0A%09%09final Factory%3CGenotype%3CG%3E%3E encoding,%0A%09%09final Function%3CGenotype%3CG%3E, T%3E decoder,%0A%09%09final Function%3CT, Genotype%3CG%3E%3E encoder%0A%09) %7B%0A%09%09requireNonNull(encoding);%0A%09%09requireNonNull(decoder);%0A%09%09requireNonNull(encoder);%0A%0A%09%09return new Encodec%3CT, G%3E() %7B%0A%09%09%09@Override%0A%09%09%09public Function%3CT, Genotype%3CG%3E%3E encoder() %7B%0A%09%09%09%09return encoder;%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public Factory%3CGenotype%3CG%3E%3E encoding() %7B%0A%09%09%09%09return encoding;%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public Function%3CGenotype%3CG%3E, T%3E decoder() %7B%0A%09%09%09%09return decoder;%0A%09%09%09%7D%0A%09%09%7D;%0A%09%7D%0A%0A
 %7D%0A

Add 'Encodec' factory method.