Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 82   Methods: 10
NCLOC: 50   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DataElement.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;
 11   
 12    import java.util.*;
 13   
 14    /**
 15    * Element owning a tag name and holding attributes.
 16    * Used by the DataTreeBuilder.
 17    *
 18    * @author Klaus Meffert
 19    * @since 2.0
 20    */
 21    public class DataElement
 22    implements IDataElement {
 23    /** String containing the CVS revision. Read out via reflection!*/
 24    private final static String CVS_REVISION = "$Revision: 1.5 $";
 25   
 26    private IDataElementList m_elements;
 27   
 28    private Map m_attributes;
 29   
 30    private String m_tagName;
 31   
 32  58 public DataElement(final String a_tagName) {
 33  58 m_elements = new DataElementList();
 34  58 m_attributes = new HashMap();
 35  58 m_tagName = a_tagName;
 36    }
 37   
 38  43 public void setAttribute(final String a_name, final String a_value)
 39    throws Exception {
 40  43 m_attributes.put(a_name, a_value);
 41    }
 42   
 43  49 public void appendChild(final IDataElement a_newChild)
 44    throws Exception {
 45  49 m_elements.add(a_newChild);
 46    }
 47   
 48  49 public String getTagName() {
 49  49 return m_tagName;
 50    }
 51   
 52  3 public IDataElementList getElementsByTagName(final String a_name) {
 53  3 IDataElementList ret = new DataElementList();
 54  3 for (int i = 0; i < m_elements.getLength(); i++) {
 55  4 if (m_elements.item(i).getTagName().equals(a_name)) {
 56  1 ret.add(m_elements.item(i));
 57    }
 58    }
 59  3 return ret;
 60    }
 61   
 62  1 public short getNodeType() {
 63  1 return 1;
 64    }
 65   
 66  2 public String getNodeValue()
 67    throws Exception {
 68  2 return null;
 69    }
 70   
 71  34 public IDataElementList getChildNodes() {
 72  34 return m_elements;
 73    }
 74   
 75  12 public String getAttribute(final String a_name) {
 76  12 return (String) m_attributes.get(a_name);
 77    }
 78   
 79  12 public Map getAttributes() {
 80  12 return m_attributes;
 81    }
 82    }