Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 107   Methods: 5
NCLOC: 50   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SpecificationHandler.java 87,5% 90,5% 100% 90,5%
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.base.module.Specification;
 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    import org.qedeq.kernel.xml.parser.SyntaxException;
 27   
 28   
 29    /**
 30    * Parse specification informations.
 31    *
 32    * @version $Revision: 1.10 $
 33    * @author Michael Meyling
 34    */
 35    public final class SpecificationHandler extends AbstractSimpleHandler {
 36   
 37    /** Specification value object. */
 38    private Specification specification;
 39   
 40    /** Module name. */
 41    private String moduleName;
 42   
 43    /** Rule version which is at least needed to verify this module. */
 44    private String ruleVersion;
 45   
 46    /** List of locations for module. */
 47    private LocationListVo locations;
 48   
 49   
 50    /**
 51    * Constructor.
 52    *
 53    * @param handler Parent handler.
 54    * @param startTag XML part start with this tag.
 55    */
 56  75 public SpecificationHandler(final AbstractSimpleHandler handler, final String startTag) {
 57  75 super(handler, startTag);
 58    }
 59   
 60  72 public final void init() {
 61  72 specification = null;
 62  72 moduleName = null;
 63  72 ruleVersion = null;
 64  72 locations = null;
 65    }
 66   
 67    /**
 68    * Get specification.
 69    *
 70    * @return Module specification.
 71    */
 72  72 public final Specification getSpecification() {
 73  72 return specification;
 74    }
 75   
 76  249 public final void startElement(final String name, final SimpleAttributes attributes)
 77    throws SyntaxException {
 78  249 if (getStartTag().equals(name)) {
 79  72 locations = new LocationListVo();
 80  72 moduleName = attributes.getString("name");
 81  72 ruleVersion = attributes.getString("ruleVersion");
 82  177 } else if ("SPECIFICATION".equals(name)) {
 83    // ignore
 84  144 } else if ("LOCATIONS".equals(name)) {
 85    // ignore
 86  72 } else if ("LOCATION".equals(name)) {
 87  72 locations.add(new LocationVo(attributes.getString("value")));
 88    } else {
 89  0 throw SyntaxException.createUnexpectedTagException(name);
 90    }
 91    }
 92   
 93  249 public final void endElement(final String name) throws SyntaxException {
 94  249 if (getStartTag().equals(name)) {
 95  72 specification = new SpecificationVo(moduleName, ruleVersion, locations);
 96  177 } else if ("SPECIFICATION".equals(name)) {
 97    // ignore
 98  144 } else if ("LOCATIONS".equals(name)) {
 99    // ignore
 100  72 } else if ("LOCATION".equals(name)) {
 101    // ignore
 102    } else {
 103  0 throw SyntaxException.createUnexpectedTagException(name);
 104    }
 105    }
 106   
 107    }