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

nameclass, %method, %block, %line, %
TermHandler.java100% (1/1)100% (5/5)90%  (55/61)88%  (14/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TermHandler100% (1/1)100% (5/5)90%  (55/61)88%  (14/16)
startElement (String, SimpleAttributes): void 100% (1/1)86%  (18/21)80%  (4/5)
endElement (String): void 100% (1/1)86%  (19/22)80%  (4/5)
TermHandler (AbstractSimpleHandler): void 100% (1/1)100% (11/11)100% (3/3)
getTerm (): TermVo 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.TermVo;
19import org.qedeq.kernel.xml.common.XmlSyntaxException;
20import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
21import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
22import org.qedeq.kernel.xml.handler.list.ElementHandler;
23 
24 
25/**
26 * Parse term.
27 *
28 * @version $Revision: 1.1 $
29 * @author  Michael Meyling
30 */
31public class TermHandler extends AbstractSimpleHandler {
32 
33    /** Value object for term. */
34    private TermVo term;
35 
36    /** Handles {@link org.qedeq.kernel.se.base.list.Element}s. */
37    private final ElementHandler elementHandler;
38 
39 
40    /**
41     * Handles terms.
42     *
43     * @param   handler     Parent handler.
44     */
45    public TermHandler(final AbstractSimpleHandler handler) {
46        super(handler, "TERM");
47        elementHandler = new ElementHandler(this);
48    }
49 
50    public final void init() {
51        term = null;
52    }
53 
54    /**
55     * Get parsed result.
56     *
57     * @return  Term.
58     */
59    public final TermVo getTerm() {
60        return term;
61    }
62 
63    public final void startElement(final String name, final SimpleAttributes attributes)
64            throws XmlSyntaxException {
65        if (getStartTag().equals(name)) {
66            // nothing to do
67        } else if (getLevel() > 1) {
68            changeHandler(elementHandler, name, attributes);
69        } else {
70            throw XmlSyntaxException.createUnexpectedTagException(name);
71        }
72    }
73 
74    public final void endElement(final String name) throws XmlSyntaxException {
75        if (getStartTag().equals(name)) {
76            term = new TermVo(elementHandler.getElement());
77        } else if (getLevel() <= 1) {
78            throw XmlSyntaxException.createUnexpectedTagException(name);
79        }
80    }
81}

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