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

nameclass, %method, %block, %line, %
LatexListHandler.java100% (1/1)100% (6/6)78%  (65/83)85%  (17/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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