Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
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.9 2005/08/19 04:13:28 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2005, 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.9 $
 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  51 public SpecificationHandler(final AbstractSimpleHandler handler, final String startTag) {
 57  51 super(handler, startTag);
 58    }
 59   
 60  53 public final void init() {
 61  53 specification = null;
 62  53 moduleName = null;
 63  53 ruleVersion = null;
 64  53 locations = null;
 65    }
 66   
 67    /**
 68    * Get specification.
 69    *
 70    * @return Module specification.
 71    */
 72  53 public final Specification getSpecification() {
 73  53 return specification;
 74    }
 75   
 76  185 public final void startElement(final String name, final SimpleAttributes attributes)
 77    throws SyntaxException {
 78  185 if (getStartTag().equals(name)) {
 79  53 locations = new LocationListVo();
 80  53 moduleName = attributes.getString("name");
 81  53 ruleVersion = attributes.getString("ruleVersion");
 82  132 } else if ("SPECIFICATION".equals(name)) {
 83    // ignore
 84  106 } else if ("LOCATIONS".equals(name)) {
 85    // ignore
 86  53 } else if ("LOCATION".equals(name)) {
 87  53 locations.add(new LocationVo(attributes.getString("value")));
 88    } else {
 89  0 throw SyntaxException.createUnexpectedTagException(name);
 90    }
 91    }
 92   
 93  185 public final void endElement(final String name) throws SyntaxException {
 94  185 if (getStartTag().equals(name)) {
 95  53 specification = new SpecificationVo(moduleName, ruleVersion, locations);
 96  132 } else if ("SPECIFICATION".equals(name)) {
 97    // ignore
 98  106 } else if ("LOCATIONS".equals(name)) {
 99    // ignore
 100  53 } else if ("LOCATION".equals(name)) {
 101    // ignore
 102    } else {
 103  0 throw SyntaxException.createUnexpectedTagException(name);
 104    }
 105    }
 106   
 107    }