Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../../img/srcFileCovDistChart8.png 47% of files have more coverage
15   96   11   2,5
10   45   0,73   6
6     1,83  
1    
 
  LatexListHandler       Line # 32 15 11 80,6% 0.8064516
 
  (41)
 
1    /* $Id: LatexListHandler.java,v 1.1 2008/07/26 08:00:51 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU General Public
9    * License as published by the Free Software Foundation; either
10    * version 2 of the License, or (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    * GNU General Public License for more details.
16    */
17   
18    package org.qedeq.kernel.xml.handler.module;
19   
20    import org.qedeq.kernel.dto.module.LatexListVo;
21    import org.qedeq.kernel.dto.module.LatexVo;
22    import org.qedeq.kernel.xml.common.XmlSyntaxException;
23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
25   
26    /**
27    * Parse header informations.
28    *
29    * @version $Revision: 1.1 $
30    * @author Michael Meyling
31    */
 
32    public class LatexListHandler extends AbstractSimpleHandler {
33   
34    /** Text language. */
35    private String language;
36   
37    /** LaTeX text. */
38    private LatexListVo list;
39   
40    /** Character data. */
41    private String data;
42   
43    /**
44    * Handles LaTeX tags.
45    *
46    * @param handler Handler that uses this handler.
47    * @param startTag This is the starting tag.
48    */
 
49  2800 toggle public LatexListHandler(final AbstractSimpleHandler handler, final String startTag) {
50  2800 super(handler, startTag);
51    }
52   
 
53  4878 toggle public final void init() {
54  4878 list = new LatexListVo();
55    }
56   
57    /**
58    * Get parsed result.
59    *
60    * @return LaTeX text parts.
61    */
 
62  4878 toggle public final LatexListVo getLatexList() {
63  4878 return list;
64    }
65   
 
66  13742 toggle public final void startElement(final String name, final SimpleAttributes attributes)
67    throws XmlSyntaxException {
68  13742 if (getStartTag().equals(name)) {
69    // ignore
70  8864 } else if ("LATEX".equals(name)) {
71  8864 this.data = null;
72  8864 language = attributes.getString("language");
73    } else {
74  0 throw XmlSyntaxException.createUnexpectedTagException(name);
75    }
76    }
77   
 
78  13742 toggle public final void endElement(final String name) throws XmlSyntaxException {
79  13742 if (getStartTag().equals(name)) {
80    // ignore
81  8864 } else if ("LATEX".equals(name)) {
82  8864 list.add(new LatexVo(language, data));
83    } else {
84  0 throw XmlSyntaxException.createUnexpectedTagException(name);
85    }
86    }
87   
 
88  8837 toggle public final void characters(final String name, final String data) {
89  8837 if ("LATEX".equals(name)) {
90  8837 this.data = data;
91    } else {
92  0 throw new RuntimeException("Unexpected character data in tag: " + name);
93    }
94    }
95   
96    }