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

nameclass, %method, %block, %line, %
LatexHandler.java100% (1/1)100% (6/6)86%  (67/78)85%  (17.8/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LatexHandler100% (1/1)100% (6/6)86%  (67/78)85%  (17.8/21)
characters (String, String): void 100% (1/1)74%  (14/19)77%  (3.8/5)
startElement (String, SimpleAttributes): void 100% (1/1)87%  (20/23)83%  (5/6)
endElement (String): void 100% (1/1)88%  (21/24)80%  (4/5)
LatexHandler (AbstractSimpleHandler, String): void 100% (1/1)100% (5/5)100% (2/2)
getLatex (): LatexVo 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.LatexVo;
19import org.qedeq.kernel.xml.common.XmlSyntaxException;
20import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
21import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
22 
23 
24/**
25 * Parse header informations.
26 *
27 * @version $Revision: 1.1 $
28 * @author  Michael Meyling
29 */
30public class LatexHandler extends AbstractSimpleHandler {
31 
32    /** Text language. */
33    private String language;
34 
35    /** LaTeX text. */
36    private LatexVo latex;
37 
38    /** Character data. */
39    private String data;
40 
41 
42    /**
43     * Handles LaTeX tags.
44     *
45     * @param   handler Handler that uses this handler.
46     * @param   startTag    This is the starting tag.
47     */
48    public LatexHandler(final AbstractSimpleHandler handler, final String startTag) {
49        super(handler, startTag);
50    }
51 
52    public final void init() {
53        latex = null;
54    }
55 
56    /**
57     * Get parsed result.
58     *
59     * @return  LaTeX text part.
60     */
61    public final LatexVo getLatex() {
62        return latex;
63    }
64 
65    public final void startElement(final String name, final SimpleAttributes attributes)
66            throws XmlSyntaxException {
67        if (getStartTag().equals(name)) {
68            // ignore
69        } else if ("LATEX".equals(name)) {
70            this.data = null;
71            language = attributes.getString("language");
72        } else {
73            throw XmlSyntaxException.createUnexpectedTagException(name);
74        }
75    }
76 
77    public void endElement(final String name) throws XmlSyntaxException {
78        if (getStartTag().equals(name)) {
79            // ignore
80        } else if ("LATEX".equals(name)) {
81            latex = new LatexVo(language, data);
82        } else {
83            throw XmlSyntaxException.createUnexpectedTagException(name);
84        }
85    }
86 
87    public void characters(final String name, final String data) throws XmlSyntaxException {
88        if (getStartTag().equals(name)) {
89            // ignore
90        } else if ("LATEX".equals(name)) {
91            this.data = data;
92        } else {
93            throw XmlSyntaxException.createUnexpectedTextDataException(name, data);
94        }
95    }
96 
97}

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