@Test public void serialize() throws IOException { final ProgramGene<Double> object = new ProgramGene<>( OPERATIONS.get(0), 0, OPERATIONS, TERMINALS ); final byte[] data = IO.object.toByteArray(object); Assert.assertEquals(IO.object.fromByteArray(data), object); }
private static <A> Op<A> get(final Op<A> op) { final Op<A> instance = op.get(); if (instance != op && instance.arity() != op.arity()) { throw new IllegalArgumentException(format( "Original op and created op have different arity: %d != %d,", instance.arity(), op.arity() )); } return instance; }
ProgramGene extends AbstractTreeGene<Op<A>, ProgramGene<A>> implements Gene<Op<A>, ProgramGene<A>>, Function<A[], A> { private static <A> Op<A> get(final Op<A> op) { final Op<A> instance = op.get(); if (instance != op && instance.arity() != op.arity()) { throw new IllegalArgumentException(format( "Original op and created op have different arity: %d != %d,", instance.arity(), op.arity() )); } return instance; } }
ProgramGene extends AbstractTreeGene<Op<A>, ProgramGene<A>> implements Gene<Op<A>, ProgramGene<A>>, Function<A[], A> { private static <A> Op<A> get(final Op<A> op) { final Op<A> instance = op.get(); if (instance != op && instance.arity() != op.arity()) { throw new IllegalArgumentException(format( "Original op and created op have different arity: %d != %d,", instance.arity(), op.arity() )); } return instance; } ProgramGene(
		final Op<A> op,
		final int childOffset,
		final ISeq<? extends Op<A>> operations,
		final ISeq<? extends Op<A>> terminals
	); }
ProgramGene extends AbstractTreeGene<Op<A>, ProgramGene<A>> implements Gene<Op<A>, ProgramGene<A>>, Function<A[], A> { private static <A> Op<A> get(final Op<A> op) { final Op<A> instance = op.get(); if (instance != op && instance.arity() != op.arity()) { throw new IllegalArgumentException(format( "Original op and created op have different arity: %d != %d,", instance.arity(), op.arity() )); } return instance; } ProgramGene(
		final Op<A> op,
		final int childOffset,
		final ISeq<? extends Op<A>> operations,
		final ISeq<? extends Op<A>> terminals
	); @Override A apply(final A[] args); @SafeVarargs final A eval(final A... args); ISeq<Op<A>> operations(); ISeq<Op<A>> terminals(); TreeNode<Op<A>> toTreeNode(); @Override ProgramGene<A> newInstance(); @Override ProgramGene<A> newInstance(final Op<A> op); @Override ProgramGene<A> newInstance(
		final Op<A> op,
		final int childOffset,
		final int childCount
	); }
ProgramGene extends AbstractTreeGene<Op<A>, ProgramGene<A>> implements Gene<Op<A>, ProgramGene<A>>, Function<A[], A> { private static <A> Op<A> get(final Op<A> op) { final Op<A> instance = op.get(); if (instance != op && instance.arity() != op.arity()) { throw new IllegalArgumentException(format( "Original op and created op have different arity: %d != %d,", instance.arity(), op.arity() )); } return instance; } ProgramGene(
		final Op<A> op,
		final int childOffset,
		final ISeq<? extends Op<A>> operations,
		final ISeq<? extends Op<A>> terminals
	); @Override A apply(final A[] args); @SafeVarargs final A eval(final A... args); ISeq<Op<A>> operations(); ISeq<Op<A>> terminals(); TreeNode<Op<A>> toTreeNode(); @Override ProgramGene<A> newInstance(); @Override ProgramGene<A> newInstance(final Op<A> op); @Override ProgramGene<A> newInstance(
		final Op<A> op,
		final int childOffset,
		final int childCount
	);  }