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

nameclass, %method, %block, %line, %
AxiomHandler.java100% (1/1)100% (5/5)70%  (76/108)74%  (17/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AxiomHandler100% (1/1)100% (5/5)70%  (76/108)74%  (17/23)
endElement (String): void 100% (1/1)56%  (20/36)57%  (4/7)
startElement (String, SimpleAttributes): void 100% (1/1)66%  (31/47)67%  (6/9)
AxiomHandler (AbstractSimpleHandler): void 100% (1/1)100% (18/18)100% (4/4)
getAxiom (): Axiom 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.base.module.Axiom;
19import org.qedeq.kernel.se.dto.module.AxiomVo;
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 an axiom.
27 *
28 * @version $Revision: 1.1 $
29 * @author  Michael Meyling
30 */
31public class AxiomHandler extends AbstractSimpleHandler {
32 
33    /** Handler for axiom formula. */
34    private final FormulaHandler formulaHandler;
35 
36    /** Handler for rule description. */
37    private final LatexListHandler descriptionHandler;
38 
39    /** Axiom value object. */
40    private AxiomVo axiom;
41 
42    /**
43     * Deals with axioms.
44     *
45     * @param   handler Parent handler.
46     */
47    public AxiomHandler(final AbstractSimpleHandler handler) {
48        super(handler, "AXIOM");
49        formulaHandler = new FormulaHandler(this);
50        descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
51    }
52 
53    public final void init() {
54        axiom = null;
55    }
56 
57    /**
58     * Get axiom.
59     *
60     * @return  Axiom.
61     */
62    public final Axiom getAxiom() {
63        return axiom;
64    }
65 
66    public final void startElement(final String name, final SimpleAttributes attributes)
67            throws XmlSyntaxException {
68        if (getStartTag().equals(name)) {
69            axiom = new AxiomVo();
70            axiom.setDefinedOperator(attributes.getString("definedOperator"));
71        } else if (formulaHandler.getStartTag().equals(name)) {
72            changeHandler(formulaHandler, name, attributes);
73        } else if (descriptionHandler.getStartTag().equals(name)) {
74            changeHandler(descriptionHandler, name, attributes);
75        } else {
76            throw XmlSyntaxException.createUnexpectedTagException(name);
77        }
78    }
79 
80    public final void endElement(final String name) throws XmlSyntaxException {
81        if (getStartTag().equals(name)) {
82            // nothing to do
83        } else if (formulaHandler.getStartTag().equals(name)) {
84            axiom.setFormula(formulaHandler.getFormula());
85        } else if (descriptionHandler.getStartTag().equals(name)) {
86            axiom.setDescription(descriptionHandler.getLatexList());
87        } else {
88            throw XmlSyntaxException.createUnexpectedTagException(name);
89        }
90    }
91 
92}

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