Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 111   Methods: 4
NCLOC: 29   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
GeneticEvent.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.event;
 11   
 12    import java.util.EventObject;
 13   
 14    /**
 15    * Represents events that are fired via the EventManager when various
 16    * genetic events occur. The specific kind of event is conveyed through the
 17    * event name. Standard event names are provided as constants in this class.
 18    *
 19    * @author Neil Rotstan
 20    * @author Klaus Meffert
 21    * @since 1.0
 22    */
 23    public class GeneticEvent
 24    extends EventObject {
 25    /** String containing the CVS revision. Read out via reflection!*/
 26    private final static String CVS_REVISION = "$Revision: 1.8 $";
 27   
 28    /**
 29    * Multi-purpose value object
 30    */
 31    private Object m_value;
 32   
 33    /**
 34    * Public constant representing the name of the event that is fired each
 35    * time a Genotype is finished with a single evolution cycle.
 36    */
 37    public static final String GENOTYPE_EVOLVED_EVENT =
 38    "genotype_evolved_event";
 39   
 40    public static final String GPGENOTYPE_EVOLVED_EVENT =
 41    "gpgenotype_evolved_event";
 42   
 43    public static final String GPGENOTYPE_NEW_BEST_SOLUTION =
 44    "gpgenotype_best_solution";
 45   
 46    /**
 47    * References the name of this event instance.
 48    */
 49    private final String m_eventName;
 50   
 51    /**
 52    * Constructs a new GeneticEvent of the given name.
 53    *
 54    * @param a_eventName the name of the event
 55    * @param a_source the genetic object that acted as the source of the event.
 56    * The type of this object will be dependent on the kind of event (which can
 57    * be identified by the event name). It may not be null
 58    *
 59    * @throws IllegalArgumentException if the given source object is null
 60    *
 61    * @author Neil Rotstan
 62    * @since 1.0
 63    */
 64  36 public GeneticEvent(final String a_eventName, final Object a_source) {
 65  36 super(a_source);
 66  36 m_eventName = a_eventName;
 67    }
 68   
 69    /**
 70    * Constructs a new GeneticEvent of the given name.
 71    *
 72    * @param a_eventName the name of the event
 73    * @param a_source the genetic object that acted as the source of the event.
 74    * The type of this object will be dependent on the kind of event (which can
 75    * be identified by the event name). It may not be null
 76    * @param a_value informative value of the event
 77    *
 78    * @throws IllegalArgumentException if the given source object is null
 79    *
 80    * @author Neil Rotstan
 81    * @since 1.0
 82    */
 83  1 public GeneticEvent(final String a_eventName, final Object a_source,
 84    final Object a_value) {
 85  1 this(a_eventName, a_source);
 86  1 m_value = a_value;
 87    }
 88   
 89    /**
 90    * Retrieves the name of this event, which can be used to identify the
 91    * type of event.
 92    *
 93    * @return the name of this GeneticEvent instance
 94    *
 95    * @author Neil Rotstan
 96    * @since 1.0
 97    */
 98  36 public String getEventName() {
 99  36 return m_eventName;
 100    }
 101   
 102    /**
 103    * @return multi-purpose value of the event
 104    *
 105    * @author Klaus Meffert
 106    * @since 3.0
 107    */
 108  1 public Object getValue() {
 109  1 return m_value;
 110    }
 111    }