Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 79   Methods: 5
NCLOC: 24   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
StaticFitnessFunction.java - 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    * Fitness function always returning the same value.<p>
 16    * Only for testing purpose!
 17    *
 18    * @author Klaus Meffert
 19    * @since 1.1
 20    */
 21    public class StaticFitnessFunction
 22    extends FitnessFunction {
 23   
 24    /** String containing the CVS revision. Read out via reflection!*/
 25    private final static String CVS_REVISION = "$Revision: 1.9 $";
 26   
 27    /**
 28    * @since 2.0 (until 1.1: type int)
 29    */
 30    private double m_staticFitnessValue;
 31   
 32    /**
 33    * @param a_staticFitnessValue double
 34    *
 35    * @author Klaus Meffert
 36    * @since 2.0 (until 1.1: input type int)
 37    */
 38  2146 public StaticFitnessFunction(double a_staticFitnessValue) {
 39  2146 m_staticFitnessValue = a_staticFitnessValue;
 40    }
 41   
 42    /**
 43    * @param a_chrom ignored: the Chromosome to evaluate
 44    * @return static fitness value
 45    *
 46    * @author Klaus Meffert
 47    * @since 2.0 (until 1.1: return type int)
 48    */
 49  142 public double evaluate(IChromosome a_chrom) {
 50  142 double result = m_staticFitnessValue;
 51  142 return result;
 52    }
 53   
 54    /**
 55    * @return double typed fitness value
 56    *
 57    * @author Klaus Meffert
 58    * @since 2.0 (until 1.1: return type int)
 59    */
 60  3 public double getStaticFitnessValue() {
 61  3 return m_staticFitnessValue;
 62    }
 63   
 64    /**
 65    * @param a_staticFitnessValue the value to return as fitness value when
 66    * calling evaluate()
 67    *
 68    * @author Klaus Meffert
 69    * @since 2.0 (until 1.1: type int)
 70    */
 71  1 public void setStaticFitnessValue(double a_staticFitnessValue) {
 72  1 m_staticFitnessValue = a_staticFitnessValue;
 73    }
 74   
 75  2195 public int hashCode() {
 76  2195 int result = new Double(m_staticFitnessValue).hashCode();
 77  2195 return result;
 78    }
 79    }