Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
19   101   11   3,8
12   47   0,58   5
5     2,2  
1    
 
  SpecificationHandler       Line # 34 19 11 88,9% 0.8888889
 
  (41)
 
1    /* $Id: SpecificationHandler.java,v 1.1 2008/07/26 08:00:51 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, 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.common.XmlSyntaxException;
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.1 $
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  420 toggle public SpecificationHandler(final AbstractSimpleHandler handler) {
55  420 super(handler, "SPECIFICATION");
56    }
57   
 
58  313 toggle public final void init() {
59  313 specification = null;
60  313 moduleName = null;
61  313 ruleVersion = null;
62  313 locations = null;
63    }
64   
65    /**
66    * Get specification.
67    *
68    * @return Module specification.
69    */
 
70  313 toggle public final SpecificationVo getSpecification() {
71  313 return specification;
72    }
73   
 
74  989 toggle public final void startElement(final String name, final SimpleAttributes attributes)
75    throws XmlSyntaxException {
76  989 if (getStartTag().equals(name)) {
77  313 locations = new LocationListVo();
78  313 moduleName = attributes.getString("name");
79  313 ruleVersion = attributes.getString("ruleVersion");
80  676 } else if ("LOCATIONS".equals(name)) {
81    // ignore
82  363 } else if ("LOCATION".equals(name)) {
83  363 locations.add(new LocationVo(attributes.getString("value")));
84    } else {
85  0 throw XmlSyntaxException.createUnexpectedTagException(name);
86    }
87    }
88   
 
89  989 toggle public final void endElement(final String name) throws XmlSyntaxException {
90  989 if (getStartTag().equals(name)) {
91  313 specification = new SpecificationVo(moduleName, ruleVersion, locations);
92  676 } else if ("LOCATIONS".equals(name)) {
93    // ignore
94  363 } else if ("LOCATION".equals(name)) {
95    // ignore
96    } else {
97  0 throw XmlSyntaxException.createUnexpectedTagException(name);
98    }
99    }
100   
101    }