From 727801ab8002481fd2d213b45c3b43225b0f73bb Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Wed, 12 Feb 2014 11:57:18 +0000 Subject: Added a few more tests, be back after the meeting. --- src/jcgp/population/Population.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/jcgp/population/Population.java') diff --git a/src/jcgp/population/Population.java b/src/jcgp/population/Population.java index fb968fb..56f1b50 100644 --- a/src/jcgp/population/Population.java +++ b/src/jcgp/population/Population.java @@ -8,15 +8,15 @@ public class Population implements Iterable { private Chromosome[] population; - public Population() { - population = new Chromosome[Parameters.getPopulationSize()]; - for (int c = 0; c < population.length; c++) { - population[c] = new Chromosome(); - } - } - public Population(Chromosome ... chromosomes) { - population = chromosomes; + if (chromosomes.length > 0) { + population = chromosomes; + } else { + population = new Chromosome[Parameters.getPopulationSize()]; + for (int c = 0; c < population.length; c++) { + population[c] = new Chromosome(); + } + } } @Override @@ -45,7 +45,7 @@ public class Population implements Iterable { public void remove() { // not allowed // since this would shift everything back one position, increment index - index++; + // index++; } }; -- cgit v1.2.3