EMMA Coverage Report (generated Fri Feb 14 08:28:31 UTC 2014)
[all classes][org.qedeq.kernel.xml.handler.module]

COVERAGE SUMMARY FOR SOURCE FILE [SpecificationHandler.java]

nameclass, %method, %block, %line, %
SpecificationHandler.java100% (1/1)100% (5/5)94%  (90/96)91%  (21/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SpecificationHandler100% (1/1)100% (5/5)94%  (90/96)91%  (21/23)
endElement (String): void 100% (1/1)90%  (28/31)83%  (5/6)
startElement (String, SimpleAttributes): void 100% (1/1)93%  (41/44)89%  (8/9)
SpecificationHandler (AbstractSimpleHandler): void 100% (1/1)100% (5/5)100% (2/2)
getSpecification (): SpecificationVo 100% (1/1)100% (3/3)100% (1/1)
init (): void 100% (1/1)100% (13/13)100% (5/5)

1/* This file is part of the project "Hilbert II" - http://www.qedeq.org
2 *
3 * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
4 *
5 * "Hilbert II" is free software; you can redistribute
6 * it and/or modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15 
16package org.qedeq.kernel.xml.handler.module;
17 
18import org.qedeq.kernel.se.dto.module.LocationListVo;
19import org.qedeq.kernel.se.dto.module.LocationVo;
20import org.qedeq.kernel.se.dto.module.SpecificationVo;
21import org.qedeq.kernel.xml.common.XmlSyntaxException;
22import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
23import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
24 
25 
26/**
27 * Parse specification informations.
28 *
29 * @version $Revision: 1.1 $
30 * @author  Michael Meyling
31 */
32public class SpecificationHandler extends AbstractSimpleHandler {
33 
34    /** Specification value object. */
35    private SpecificationVo specification;
36 
37    /** Module name. */
38    private String moduleName;
39 
40    /** Rule version which is at least needed to verify this module. */
41    private String ruleVersion;
42 
43    /** List of locations for module. */
44    private LocationListVo locations;
45 
46 
47    /**
48     * Constructor.
49     *
50     * @param   handler     Parent handler.
51     */
52    public SpecificationHandler(final AbstractSimpleHandler handler) {
53        super(handler, "SPECIFICATION");
54    }
55 
56    public final void init() {
57        specification = null;
58        moduleName = null;
59        ruleVersion = null;
60        locations = null;
61    }
62 
63    /**
64     * Get specification.
65     *
66     * @return  Module specification.
67     */
68    public final SpecificationVo getSpecification() {
69        return specification;
70    }
71 
72    public final void startElement(final String name, final SimpleAttributes attributes)
73            throws XmlSyntaxException {
74        if (getStartTag().equals(name)) {
75            locations = new LocationListVo();
76            moduleName = attributes.getString("name");
77            ruleVersion = attributes.getString("ruleVersion");
78        } else if ("LOCATIONS".equals(name)) {
79            // ignore
80        } else if ("LOCATION".equals(name)) {
81            locations.add(new LocationVo(attributes.getString("value")));
82        } else {
83            throw XmlSyntaxException.createUnexpectedTagException(name);
84        }
85    }
86 
87    public final void endElement(final String name) throws XmlSyntaxException {
88        if (getStartTag().equals(name)) {
89            specification = new SpecificationVo(moduleName, ruleVersion, locations);
90        } else if ("LOCATIONS".equals(name)) {
91            // ignore
92        } else if ("LOCATION".equals(name)) {
93            // ignore
94        } else {
95            throw XmlSyntaxException.createUnexpectedTagException(name);
96        }
97    }
98 
99}

[all classes][org.qedeq.kernel.xml.handler.module]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov