SimpleGrayCodeBinaryRepresentation extends SimpleBinaryRepresentation { @Override protected boolean[] decodeGenomeToBinary() { boolean[] binaryGenome = new boolean[this.genome.length]; int index = 0; for (int variable = 0; variable < this.descriptor.numVariables; variable++){ binaryGenome[index] = this.genome[index++]; for (int i = 1; i < this.descriptor.variablesLengths[variable]; i++){ binaryGenome[index] = binaryGenome[index-1] ^ this.genome[index++]; } } return binaryGenome; } SimpleGrayCodeBinaryRepresentation(SimpleBinaryGenomeDescriptor descriptor);  SimpleGrayCodeBinaryRepresentation(SimpleGrayCodeBinaryRepresentation second); @Override Representation copy();  }
@Test public void testDecodeGenomeToBinary1(){ boolean[] gray = new boolean[]{ true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, true, false, true, false, true, false, true }; assertEquals((6+2+4+10), gray.length); this.representation.genome = gray; boolean[] result = this.representation.decodeGenomeToBinary(); assertEquals((6+2+4+10), result.length); boolean[] binary = new boolean[]{ true, false, true, false, true, false, true, false, true, true, true, true, false, false, false, true, true, false, false, true, true, false }; assertEquals(binary.length, result.length); for (int i = 0; i < binary.length; i++){ Assert.assertEquals("in step " + i, binary[i], result[i]); } }