Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: So Feb 25 2007 22:22:30 CET
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.12 2007/02/25 20:05:34 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.dto.module.LocationListVo;
 21    import org.qedeq.kernel.dto.module.LocationVo;
 22    import org.qedeq.kernel.dto.module.SpecificationVo;
 23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 25    import org.qedeq.kernel.xml.parser.SyntaxException;
 26   
 27   
 28    /**
 29    * Parse specification informations.
 30    *
 31    * @version $Revision: 1.12 $
 32    * @author Michael Meyling
 33    */
 34    public final 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  108 public SpecificationHandler(final AbstractSimpleHandler handler) {
 55  108 super(handler, "SPECIFICATION");
 56    }
 57   
 58  98 public final void init() {
 59  98 specification = null;
 60  98 moduleName = null;
 61  98 ruleVersion = null;
 62  98 locations = null;
 63    }
 64   
 65    /**
 66    * Get specification.
 67    *
 68    * @return Module specification.
 69    */
 70  98 public final SpecificationVo getSpecification() {
 71  98 return specification;
 72    }
 73   
 74  294 public final void startElement(final String name, final SimpleAttributes attributes)
 75    throws SyntaxException {
 76  294 if (getStartTag().equals(name)) {
 77  98 locations = new LocationListVo();
 78  98 moduleName = attributes.getString("name");
 79  98 ruleVersion = attributes.getString("ruleVersion");
 80  196 } else if ("LOCATIONS".equals(name)) {
 81    // ignore
 82  98 } else if ("LOCATION".equals(name)) {
 83  98 locations.add(new LocationVo(attributes.getString("value")));
 84    } else {
 85  0 throw SyntaxException.createUnexpectedTagException(name);
 86    }
 87    }
 88   
 89  294 public final void endElement(final String name) throws SyntaxException {
 90  294 if (getStartTag().equals(name)) {
 91  98 specification = new SpecificationVo(moduleName, ruleVersion, locations);
 92  196 } else if ("LOCATIONS".equals(name)) {
 93    // ignore
 94  98 } else if ("LOCATION".equals(name)) {
 95    // ignore
 96    } else {
 97  0 throw SyntaxException.createUnexpectedTagException(name);
 98    }
 99    }
 100   
 101    }