Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 67   Methods: 3
NCLOC: 20   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DefaultCrossoverRateCalculator.java 100% 100% 100% 100%
coverage
 1    /*
 2    * This file is part of JGAP.
 3    *
 4    * JGAP offers a dual license model containing the LGPL as well as the MPL.
 5    *
 6    * For licencing information please see the file license.txt included with JGAP
 7    * or have a look at the top of class org.jgap.Chromosome which representatively
 8    * includes the JGAP license policy applicable for any file delivered with JGAP.
 9    */
 10    package org.jgap.impl;
 11   
 12    import org.jgap.*;
 13   
 14    /**
 15    * Default implementation of a dynamic CrossoverRateCalculator.
 16    *
 17    * @author Chris Knowles
 18    * @since 2.0
 19    */
 20    public class DefaultCrossoverRateCalculator
 21    extends BaseRateCalculator {
 22    /** String containing the CVS revision. Read out via reflection!*/
 23    private static final String CVS_REVISION = "$Revision: 1.8 $";
 24   
 25    /**
 26    *
 27    * @param a_config the configuration to use
 28    * @throws InvalidConfigurationException
 29    */
 30  16 public DefaultCrossoverRateCalculator(Configuration a_config)
 31    throws InvalidConfigurationException {
 32  16 super(a_config);
 33    }
 34   
 35    /**
 36    * Calculates the dynamic crossover rate. This is chosen to be the chromosome
 37    * size. As the chromosome gets larger we assume that it is less likely to
 38    * reproduce.
 39    *
 40    * @return calculated divisor of crossover rate
 41    *
 42    * @author Chris Knowles
 43    * @since 2.0
 44    */
 45  7 public int calculateCurrentRate() {
 46  7 int size = getConfiguration().getChromosomeSize();
 47  7 if (size < 1) {
 48  1 size = 1;
 49    }
 50  7 return size;
 51    }
 52   
 53    /**
 54    * Determines whether crossover is to be carried out for a given population.
 55    *
 56    * @param a_chrom ignored
 57    * @param a_geneIndex ignored
 58    * @return true: the DefaultCrossoverRateCalculator always returns a finite
 59    * rate
 60    *
 61    * @author Chris Knowles
 62    * @since 2.0
 63    */
 64  1 public boolean toBePermutated(IChromosome a_chrom, int a_geneIndex) {
 65  1 return true;
 66    }
 67    }