Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 101   Methods: 5
NCLOC: 47   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SpecificationHandler.java 83,3% 89,5% 100% 88,9%
coverage coverage
 1    /* $Id: SpecificationHandler.java,v 1.14 2007/05/10 00:37:50 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, Michael Meyling <mime@qedeq.org>.
 6    *
 7    * "Hilbert II" is free software; you can redistribute
 8    * it and/or modify it under the terms of the GNU General Public
 9    * License as published by the Free Software Foundation; either
 10    * version 2 of the License, or (at your option) any later version.
 11    *
 12    * This program is distributed in the hope that it will be useful,
 13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 15    * GNU General Public License for more details.
 16    */
 17   
 18    package org.qedeq.kernel.xml.handler.module;
 19   
 20    import org.qedeq.kernel.common.SyntaxException;
 21    import org.qedeq.kernel.dto.module.LocationListVo;
 22    import org.qedeq.kernel.dto.module.LocationVo;
 23    import org.qedeq.kernel.dto.module.SpecificationVo;
 24    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 25    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 26   
 27   
 28    /**
 29    * Parse specification informations.
 30    *
 31    * @version $Revision: 1.14 $
 32    * @author Michael Meyling
 33    */
 34    public class SpecificationHandler extends AbstractSimpleHandler {
 35   
 36    /** Specification value object. */
 37    private SpecificationVo specification;
 38   
 39    /** Module name. */
 40    private String moduleName;
 41   
 42    /** Rule version which is at least needed to verify this module. */
 43    private String ruleVersion;
 44   
 45    /** List of locations for module. */
 46    private LocationListVo locations;
 47   
 48   
 49    /**
 50    * Constructor.
 51    *
 52    * @param handler Parent handler.
 53    */
 54  138 public SpecificationHandler(final AbstractSimpleHandler handler) {
 55  138 super(handler, "SPECIFICATION");
 56    }
 57   
 58  114 public final void init() {
 59  114 specification = null;
 60  114 moduleName = null;
 61  114 ruleVersion = null;
 62  114 locations = null;
 63    }
 64   
 65    /**
 66    * Get specification.
 67    *
 68    * @return Module specification.
 69    */
 70  114 public final SpecificationVo getSpecification() {
 71  114 return specification;
 72    }
 73   
 74  342 public final void startElement(final String name, final SimpleAttributes attributes)
 75    throws SyntaxException {
 76  342 if (getStartTag().equals(name)) {
 77  114 locations = new LocationListVo();
 78  114 moduleName = attributes.getString("name");
 79  114 ruleVersion = attributes.getString("ruleVersion");
 80  228 } else if ("LOCATIONS".equals(name)) {
 81    // ignore
 82  114 } else if ("LOCATION".equals(name)) {
 83  114 locations.add(new LocationVo(attributes.getString("value")));
 84    } else {
 85  0 throw SyntaxException.createUnexpectedTagException(name);
 86    }
 87    }
 88   
 89  342 public final void endElement(final String name) throws SyntaxException {
 90  342 if (getStartTag().equals(name)) {
 91  114 specification = new SpecificationVo(moduleName, ruleVersion, locations);
 92  228 } else if ("LOCATIONS".equals(name)) {
 93    // ignore
 94  114 } else if ("LOCATION".equals(name)) {
 95    // ignore
 96    } else {
 97  0 throw SyntaxException.createUnexpectedTagException(name);
 98    }
 99    }
 100   
 101    }