Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart8.png 62% of files have more coverage
15   94   11   2.5
10   45   0.73   6
6     1.83  
1    
 
  LatexListHandler       Line # 30 15 11 80.6% 0.8064516
 
No Tests
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, 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   
16    package org.qedeq.kernel.xml.handler.module;
17   
18    import org.qedeq.kernel.se.dto.module.LatexListVo;
19    import org.qedeq.kernel.se.dto.module.LatexVo;
20    import org.qedeq.kernel.xml.common.XmlSyntaxException;
21    import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
22    import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
23   
24    /**
25    * Parse header informations.
26    *
27    * @version $Revision: 1.1 $
28    * @author Michael Meyling
29    */
 
30    public 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  13508 toggle public LatexListHandler(final AbstractSimpleHandler handler, final String startTag) {
48  13508 super(handler, startTag);
49    }
50   
 
51  61823 toggle public void init() {
52  61823 list = new LatexListVo();
53    }
54   
55    /**
56    * Get parsed result.
57    *
58    * @return LaTeX text parts.
59    */
 
60  61823 toggle public final LatexListVo getLatexList() {
61  61823 return list;
62    }
63   
 
64  179564 toggle public void startElement(final String name, final SimpleAttributes attributes)
65    throws XmlSyntaxException {
66  179564 if (getStartTag().equals(name)) {
67    // ignore
68  117813 } else if ("LATEX".equals(name)) {
69  117813 this.data = null;
70  117813 language = attributes.getString("language");
71    } else {
72  0 throw XmlSyntaxException.createUnexpectedTagException(name);
73    }
74    }
75   
 
76  179564 toggle public void endElement(final String name) throws XmlSyntaxException {
77  179564 if (getStartTag().equals(name)) {
78    // ignore
79  117813 } else if ("LATEX".equals(name)) {
80  117813 list.add(new LatexVo(language, data));
81    } else {
82  0 throw XmlSyntaxException.createUnexpectedTagException(name);
83    }
84    }
85   
 
86  117483 toggle public final void characters(final String name, final String data) {
87  117483 if ("LATEX".equals(name)) {
88  117483 this.data = data;
89    } else {
90  0 throw new RuntimeException("Unexpected character data in tag: " + name);
91    }
92    }
93   
94    }