Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 54   Methods: 2
NCLOC: 25   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DeltaFitnessEvaluator.java 75% 80% 100% 80%
coverage 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;
 11   
 12    /**
 13    * An implementation of a fitness evaluator interpreting the fitness as delta
 14    * value.
 15    *
 16    * @author Klaus Meffert
 17    * @since 2.0
 18    */
 19    public class DeltaFitnessEvaluator
 20    implements FitnessEvaluator {
 21    /** String containing the CVS revision. Read out via reflection!*/
 22    private final static String CVS_REVISION = "$Revision: 1.8 $";
 23   
 24    /**
 25    * Compares the first given fitness value with the second and returns true
 26    * if the first one is smaller than the second one. Otherwise returns false
 27    * @param a_fitness_value1 first fitness value
 28    * @param a_fitness_value2 second fitness value
 29    * @return true: first fitness value smaller than second
 30    *
 31    * @since 2.0 (until 1.1: input types int)
 32    */
 33  119 public boolean isFitter(final double a_fitness_value1,
 34    final double a_fitness_value2) {
 35  119 if (Double.isNaN(a_fitness_value1)) {
 36  0 return false;
 37    }
 38  119 else if (!Double.isNaN(a_fitness_value1) &&
 39    !Double.isNaN(a_fitness_value2)) {
 40  119 if (a_fitness_value1 < 0) {
 41  4 return false;
 42    }
 43  115 if (a_fitness_value2 < 0) {
 44  1 return true;
 45    }
 46  114 return a_fitness_value1 < a_fitness_value2;
 47    }
 48  0 return true;
 49    }
 50   
 51  4 public boolean isFitter(IChromosome a_chrom1, IChromosome a_chrom2) {
 52  4 return isFitter(a_chrom1.getFitnessValue(), a_chrom2.getFitnessValue());
 53    }
 54    }