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