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 [ImportListHandler.java]

nameclass, %method, %block, %line, %
ImportListHandler.java100% (1/1)100% (5/5)93%  (83/89)90%  (18/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ImportListHandler100% (1/1)100% (5/5)93%  (83/89)90%  (18/20)
endElement (String): void 100% (1/1)91%  (30/33)83%  (5/6)
startElement (String, SimpleAttributes): void 100% (1/1)92%  (35/38)88%  (7/8)
ImportListHandler (AbstractSimpleHandler): void 100% (1/1)100% (11/11)100% (3/3)
getImportList (): ImportListVo 100% (1/1)100% (3/3)100% (1/1)
init (): void 100% (1/1)100% (4/4)100% (2/2)

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.ImportListVo;
19import org.qedeq.kernel.se.dto.module.ImportVo;
20import org.qedeq.kernel.xml.common.XmlSyntaxException;
21import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
22import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
23 
24 
25/**
26 * Parse author list.
27 *
28 * @version $Revision: 1.1 $
29 * @author  Michael Meyling
30 */
31public class ImportListHandler extends AbstractSimpleHandler {
32 
33    /** Value object with list of all module imports. */
34    private ImportListVo list;
35 
36    /** Handler for a single module specification. */
37    private final SpecificationHandler specificationHandler;
38 
39    /** Label for a single module. */
40    private String label;
41 
42 
43    /**
44     * Handles list of imports.
45     *
46     * @param   handler Parent handler.
47     */
48    public ImportListHandler(final AbstractSimpleHandler handler) {
49        super(handler, "IMPORTS");
50        specificationHandler = new SpecificationHandler(this);
51    }
52 
53    public final void init() {
54        list = null;
55    }
56 
57    /**
58     * Get parsed result.
59     *
60     * @return  Location list.
61     */
62    public final ImportListVo getImportList() {
63        return list;
64    }
65 
66    public final void startElement(final String name, final SimpleAttributes attributes)
67            throws XmlSyntaxException {
68        if (getStartTag().equals(name)) {
69            list = new ImportListVo();
70        } else if ("IMPORT".equals(name)) {
71            label = attributes.getString("label");
72        } else if (specificationHandler.getStartTag().equals(name)) {
73            changeHandler(specificationHandler, name, attributes);
74        } else {
75            throw XmlSyntaxException.createUnexpectedTagException(name);
76        }
77    }
78 
79    public final void endElement(final String name) throws XmlSyntaxException {
80        if (getStartTag().equals(name)) {
81            // nothing to do
82        } else if (specificationHandler.getStartTag().equals(name)) {
83            // nothing to do
84        } else if ("IMPORT".equals(name)) {
85            list.add(new ImportVo(label, specificationHandler.getSpecification()));
86        } else {
87            throw XmlSyntaxException.createUnexpectedTagException(name);
88        }
89    }
90}

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