Clover coverage report -
Coverage timestamp: Sat Jul 7 2007 16:41:13 CEST
file stats: LOC: 88   Methods: 6
NCLOC: 31   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ParametersMap.java 100% 100% 100% 100%
coverage
 1    /**
 2    * JTRunner is free software; you can redistribute it and/or modify it under the
 3    * terms of the GNU General Public License as published by the Free Software
 4    * Foundation; either version 2, or (at your option) any later version.
 5    */
 6   
 7    package jtr.config;
 8   
 9    import java.io.Serializable;
 10    import java.util.*;
 11    import org.apache.log4j.Logger;
 12   
 13    /**
 14    * A <code>ParametersMap</code> is a set of <code>RunnerConfigParam</code>
 15    * instances. Duplicates are not allowed. Each <code>RunnerConfigParam</code>
 16    * is uniquely identified by its name attribute.
 17    *
 18    * @author Francesco Russo (frusso@dev.java.net)
 19    * @version 4.0
 20    * @since 1.0
 21    */
 22    public class ParametersMap implements Serializable {
 23    /**
 24    * Constructor.
 25    */
 26  13 public ParametersMap() {
 27  13 params = new HashMap<String,RunnerConfigParam>();
 28    }
 29   
 30    /**
 31    * Adds a new parameter to the set.
 32    *
 33    * @param param
 34    * RunnerConfigParam
 35    */
 36  33 public void addParameter(final RunnerConfigParam param) {
 37  33 params.put(param.getName(), param);
 38    }
 39   
 40    /**
 41    * Get a previously added parameter by name.
 42    *
 43    * @param paramName
 44    * String
 45    * @return RunnerConfigParam
 46    */
 47  22084 public RunnerConfigParam getParameter(String paramName) {
 48  22083 return (RunnerConfigParam) params.get(paramName);
 49    }
 50   
 51    /**
 52    * States whether the providede parameter is already in the current set.
 53    *
 54    * @param paramName
 55    * String
 56    * @return boolean
 57    */
 58  96393 public boolean containsKey(String paramName) {
 59  96402 return params.containsKey(paramName);
 60    }
 61   
 62    /**
 63    * Returns an <code>Iterator</code> to roll over the content of the
 64    * current <code>ParametersMap</code>.
 65    *
 66    * @return Iterator
 67    */
 68  16068 public Iterator iterator() {
 69  16068 return params.values().iterator();
 70    }
 71   
 72    /**
 73    * @see java.lang.Object#toString()
 74    */
 75  198520 public String toString() {
 76  198517 String res = "ParametersMap{";
 77  198523 Iterator iter = params.values().iterator();
 78  198497 while (iter.hasNext()) {
 79  387505 res = res + " " + iter.next().toString();
 80    }
 81  198521 res = res + "}";
 82  198498 return res;
 83    }
 84   
 85    private HashMap<String,RunnerConfigParam> params;
 86   
 87    private static Logger logger = Logger.getLogger(ParametersMap.class);
 88    }