Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 143   Methods: 9
NCLOC: 42   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ConfigProperty.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.data.config;
 11   
 12    import java.util.*;
 13   
 14    /**
 15    * Represents a property to be shown on the configuration screen.
 16    *
 17    * @author Siddhartha Azad
 18    * @since 2.3
 19    */
 20    public class ConfigProperty {
 21    /** String containing the CVS revision. Read out via reflection!*/
 22    private final static String CVS_REVISION = "$Revision: 1.4 $";
 23   
 24    // name of the property
 25    private String m_name;
 26   
 27    // widget to use to get the value of this property
 28    private String m_widget;
 29   
 30    // label with which to display this property
 31    private String m_label;
 32   
 33    // allowed values for this property (if applicable)
 34    private List m_values;
 35   
 36    /**
 37    * Default Constructor for a ConfigProperty.
 38    *
 39    * @author Siddhartha Azad
 40    * @since 2.3
 41    */
 42  12 public ConfigProperty() {
 43    // defaults
 44  12 m_name = "";
 45  12 m_label = "";
 46  12 m_widget = "JTextField";
 47  12 m_values = Collections.synchronizedList(new ArrayList());
 48    }
 49   
 50    /**
 51    * @return name associated with this property
 52    *
 53    * @author Siddhartha Azad
 54    * @since 2.3
 55    */
 56  2 public String getName() {
 57  2 return m_name;
 58    }
 59   
 60    /**
 61    * Setter for the name of this property.
 62    * @param a_name the name associated with this property. This name will be
 63    * used as the key in the properties file for persisting
 64    * configuration information
 65    *
 66    * @author Siddhartha Azad
 67    * @since 2.3
 68    */
 69  7 public void setName(final String a_name) {
 70  7 m_name = a_name;
 71    // by default display label is same as the name
 72  7 if (m_label.equals("")) {
 73  6 m_label = a_name;
 74    }
 75    }
 76   
 77   
 78    /**
 79    * @return name of the widget associated with this property
 80    *
 81    * @author Siddhartha Azad
 82    * @since 2.3
 83    */
 84  2 public String getWidget() {
 85  2 return m_widget;
 86    }
 87   
 88    /**
 89    * Sets the widget.
 90    * @param a_widget either "JList" or "JTextField" for now
 91    *
 92    * @author Siddhartha Azad
 93    * @since 2.3
 94    */
 95  6 public void setWidget(final String a_widget) {
 96  6 m_widget = a_widget;
 97    }
 98   
 99    /**
 100    * @return label of the property
 101    *
 102    * @author Siddhartha Azad
 103    * @since 2.4
 104    */
 105  4 public String getLabel() {
 106  4 return m_label;
 107    }
 108   
 109    /**
 110    * Sets the label.
 111    * @param a_label the label of this property, by default the same as the
 112    * name of the property
 113    *
 114    * @author Siddhartha Azad
 115    * @since 2.4
 116    */
 117  1 public void setLabel(final String a_label) {
 118  1 m_label = a_label;
 119    }
 120   
 121    /**
 122    * Add a value into the values ArrayList. These values are added in case the
 123    * display component is a ListBox or ComboBox or something that can have
 124    * multiple values.
 125    * @param a_value the value to add
 126    *
 127    * @author Siddhartha Azad
 128    * @since 2.3
 129    */
 130  7 public void addValue(final String a_value) {
 131  7 m_values.add(a_value);
 132    }
 133   
 134    /**
 135    * @return iterator on the values ArrayList for this property
 136    *
 137    * @author Siddhartha Azad
 138    * @since 2.3
 139    */
 140  3 public Iterator getValuesIter() {
 141  3 return m_values.iterator();
 142    }
 143    }