Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 53   Methods: 2
NCLOC: 33   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DefaultInitializer.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 for initializing Chromosomes.
 16    *
 17    * @author Klaus Meffert
 18    * @since 2.6
 19    */
 20    public class DefaultInitializer
 21    implements IInitializer {
 22    /** String containing the CVS revision. Read out via reflection!*/
 23    private static final String CVS_REVISION = "$Revision: 1.6 $";
 24   
 25  28 public boolean isHandlerFor(final Object a_obj, final Class a_class) {
 26  28 if (IChromosome.class.isAssignableFrom(a_class)) {
 27  23 return true;
 28    }
 29    else {
 30  5 if (a_obj != null && IInitializer.class.isAssignableFrom(a_class)) {
 31  2 IInitializer initer = (IInitializer)a_obj;
 32  2 return initer.isHandlerFor(null, a_class);
 33    }
 34    else {
 35  3 return false;
 36    }
 37    }
 38    }
 39   
 40  15730 public Object perform(final Object a_obj, final Class a_class,
 41    final Object a_params)
 42    throws Exception {
 43  15730 if (IInitializer.class.isAssignableFrom(a_class)) {
 44  15729 return ((IInitializer)a_obj).perform(null, a_class, a_params);
 45    }
 46    else {
 47  1 throw new IllegalArgumentException("DefaultInitializer not suited for"
 48    + " class"
 49    + a_class.getName()
 50    + " !");
 51    }
 52    }
 53    }