public static <T> Codec<Tree<Op<T>, ?>, ProgramGene<T>>
	codecOf(
		final ISeq<Op<T>> operations,
		final ISeq<Op<T>> terminals,
		final int depth,
		final Predicate<? super ProgramChromosome<T>> validator
	) {
		if (depth >= 30 || depth < 0) {
			throw new IllegalArgumentException(format(
				"Tree depth out of range [0, 30): %d", depth
			));
		}

		return Codec.of(
			Genotype.of(
				ProgramChromosome.of(
					depth,
					validator,
					operations,
					terminals
				)
			),
			Genotype::gene
		);
	}
Create a new <em>codec</em>, usable for <em>symbolic regression</em>
problems, with the given parameters.

@param <T> the operation type
@param operations the operations used for the symbolic regression
@param terminals the terminal operations of the program tree
@param depth the maximal tree depth (height) of newly created program
       trees
@param validator the chromosome validator. A typical validator would
       check the size of the tree and if the tree is too large, mark it
       at <em>invalid</em>. The <em>validator</em> may be {@code null}.
@return a new codec, usable for symbolic regression
@throws IllegalArgumentException if the tree {@code depth} is not in the
        valid range of {@code [0, 30)}
@throws NullPointerException if the {@code operations} or {@code terminals}
        are {@code null}
jenetics.prog/src/main/java/io/jenetics/prog/regression/Regression.java