コード例 #1
0
  protected void parseGenotype(final EvolutionState state, final LineNumberReader reader)
      throws IOException {
    // read in the next line.  The first item is the number of genes
    String s = reader.readLine();
    DecodeReturn d = new DecodeReturn(s);
    Code.decode(d);
    if (d.type != DecodeReturn.T_INTEGER) // uh oh
    state.output.fatal(
          "Individual with genome:\n"
              + s
              + "\n... does not have an integer at the beginning indicating the genome count.");
    int lll = (int) (d.l);

    genome = new boolean[lll];

    // read in the genes
    for (int i = 0; i < genome.length; i++) {
      Code.decode(d);
      genome[i] = (boolean) (d.l != 0);
    }
  }