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/Output.java | 1 - src/jcgp/population/Population.java | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/jcgp/population') diff --git a/src/jcgp/population/Output.java b/src/jcgp/population/Output.java index b3cb648..0171d7b 100644 --- a/src/jcgp/population/Output.java +++ b/src/jcgp/population/Output.java @@ -2,7 +2,6 @@ package jcgp.population; import java.util.ArrayList; - public class Output implements MutableElement { private Connection source; 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