59606162636465666768697071727374
this.size = size; } @Override public Double apply(final Genotype<BitGene> genotype) { final BitChromosome ch = (BitChromosome)genotype.getChromosome(); double size = 0; double value = 0; for (int i = 0, n = ch.length(); i < n; ++i) { if (ch.get(i)) { size += items[i].size; value += items[i].value; } }
131415161718192021
final class OneCounter implements Function<Genotype<BitGene>, Integer> { @Override public Integer apply(final Genotype<BitGene> genotype) { final BitChromosome chromosome = (BitChromosome)genotype.getChromosome(); return chromosome.bitCount(); }