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; }