コード例 #1
0
  public void savePopulationFor(Population pop, Run run, int generation) {
    File file = getFileFor(run, generation);

    if (file != null) {
      if (mode == JSON_MODE) JSONPopulationCoder.encode(pop, file);
      else XMLPopulationCoder.encode(pop, file);
    }
  }
コード例 #2
0
  public Population getPopulationFor(Run run, int generation) {
    File file = getFileFor(run, generation);
    Population pop = null;

    if (file != null) {
      if (mode == JSON_MODE) pop = JSONPopulationCoder.decode(file, run);
      else pop = XMLPopulationCoder.decode(file, run);
    } else pop = new InMemoryPopulation();

    return pop;
  }