/*
 * 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@gmx.at)
 */
package org.jenetics;

import static java.util.Objects.requireNonNull;

import java.util.function.Predicate;
import java.util.function.Supplier;

import org.jenetics.util.ISeq;

/**
 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
 * @version !__version__!
 * @since !__version__!
 */
public class AnyChromosome<A> extends AbstractChromosome<AnyGene<A>> {

	private final Supplier<? extends A> _supplier;
	private final Predicate<? super A> _validator;

	protected AnyChromosome(
		final ISeq<AnyGene<A>> genes,
		final Supplier<? extends A> supplier,
		final Predicate<? super A> validator
	) {
		super(genes);
		_supplier = requireNonNull(supplier);
		_validator = requireNonNull(validator);
	}

	@Override
	public Chromosome<AnyGene<A>> newInstance(
		final ISeq<AnyGene<A>> genes
	) {
		return new AnyChromosome<>(genes, _supplier, _validator);
	}

	@Override
	public Chromosome<AnyGene<A>> newInstance() {
		return of(length(), _supplier, _validator);
	}

	public static <A> AnyChromosome<A> of(
		final int length,
		final Supplier<? extends A> supplier,
		final Predicate<? super A> validator
	) {
		return new AnyChromosome<A>(
			AnyGene.seq(length, supplier, validator),
			supplier,
			validator
		);
	}

	public static <A> AnyChromosome<A> of(
		final int length,
		final Supplier<? extends A> supplier
	) {
		return new AnyChromosome<A>(
			AnyGene.seq(length, supplier, a -> true),
			supplier,
			a -> true
		);
	}

}

@@ -1694,18 +1694,8 @@
  of(
-length(), 
 _sup
@@ -1703,32 +1703,42 @@
 lier, _validator
+, length()
 );%0A%09%7D%0A%0A%09public s
@@ -1768,36 +1768,16 @@
 %3CA%3E of(%0A
-%09%09final int length,%0A
 %09%09final 
@@ -1838,32 +1838,52 @@
 per A%3E validator
+,%0A%09%09final int length
 %0A%09) %7B%0A%09%09return n
@@ -2027,28 +2027,8 @@
 of(%0A
-%09%09final int length,%0A
 %09%09fi
@@ -2061,16 +2061,36 @@
 supplier
+,%0A%09%09final int length
 %0A%09) %7B%0A%09%09

Change signature of factory methods.