Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 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.10 2006/10/20 20:23:02 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.10 $
 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  81 public SpecificationHandler(final AbstractSimpleHandler handler) {
 55  81 super(handler, "SPECIFICATION");
 56    }
 57   
 58  74 public final void init() {
 59  74 specification = null;
 60  74 moduleName = null;
 61  74 ruleVersion = null;
 62  74 locations = null;
 63    }
 64   
 65    /**
 66    * Get specification.
 67    *
 68    * @return Module specification.
 69    */
 70  74 public final SpecificationVo getSpecification() {
 71  74 return specification;
 72    }
 73   
 74  222 public final void startElement(final String name, final SimpleAttributes attributes)
 75    throws SyntaxException {
 76  222 if (getStartTag().equals(name)) {
 77  74 locations = new LocationListVo();
 78  74 moduleName = attributes.getString("name");
 79  74 ruleVersion = attributes.getString("ruleVersion");
 80  148 } else if ("LOCATIONS".equals(name)) {
 81    // ignore
 82  74 } else if ("LOCATION".equals(name)) {
 83  74 locations.add(new LocationVo(attributes.getString("value")));
 84    } else {
 85  0 throw SyntaxException.createUnexpectedTagException(name);
 86    }
 87    }
 88   
 89  222 public final void endElement(final String name) throws SyntaxException {
 90  222 if (getStartTag().equals(name)) {
 91  74 specification = new SpecificationVo(moduleName, ruleVersion, locations);
 92  148 } else if ("LOCATIONS".equals(name)) {
 93    // ignore
 94  74 } else if ("LOCATION".equals(name)) {
 95    // ignore
 96    } else {
 97  0 throw SyntaxException.createUnexpectedTagException(name);
 98    }
 99    }
 100   
 101    }