Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 99   Methods: 6
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LatexHandler.java 66,7% 81,2% 100% 79,4%
coverage coverage
 1    /* $Id: LatexHandler.java,v 1.12 2007/05/10 00:37:50 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, 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.common.SyntaxException;
 21    import org.qedeq.kernel.dto.module.LatexVo;
 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.12 $
 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  46 public LatexHandler(final AbstractSimpleHandler handler, final String startTag) {
 51  46 super(handler, startTag);
 52    }
 53   
 54  41 public final void init() {
 55  41 latex = null;
 56    }
 57   
 58    /**
 59    * Get parsed result.
 60    *
 61    * @return LaTeX text part.
 62    */
 63  41 public final LatexVo getLatex() {
 64  41 return latex;
 65    }
 66   
 67  82 public final void startElement(final String name, final SimpleAttributes attributes)
 68    throws SyntaxException {
 69  82 if (getStartTag().equals(name)) {
 70    // ignore
 71  41 } else if ("LATEX".equals(name)) {
 72  41 this.data = null;
 73  41 language = attributes.getString("language");
 74    } else {
 75  0 throw SyntaxException.createUnexpectedTagException(name);
 76    }
 77    }
 78   
 79  82 public void endElement(final String name) throws SyntaxException {
 80  82 if (getStartTag().equals(name)) {
 81    // ignore
 82  41 } else if ("LATEX".equals(name)) {
 83  41 latex = new LatexVo(language, data);
 84    } else {
 85  0 throw SyntaxException.createUnexpectedTagException(name);
 86    }
 87    }
 88   
 89  41 public void characters(final String name, final String data) throws SyntaxException {
 90  41 if (getStartTag().equals(name)) {
 91    // ignore
 92  41 } else if ("LATEX".equals(name)) {
 93  41 this.data = data;
 94    } else {
 95  0 throw SyntaxException.createUnexpectedTextDataException(name, data);
 96    }
 97    }
 98   
 99    }