Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
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.8 2006/10/20 20:23:02 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.parser.AbstractSimpleHandler;
 22    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 23    import org.qedeq.kernel.xml.parser.SyntaxException;
 24   
 25   
 26    /**
 27    * Parse header informations.
 28    *
 29    * @version $Revision: 1.8 $
 30    * @author Michael Meyling
 31    */
 32    public final 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  27 public LatexHandler(final AbstractSimpleHandler handler, final String startTag) {
 51  27 super(handler, startTag);
 52    }
 53   
 54  26 public final void init() {
 55  26 latex = null;
 56    }
 57   
 58    /**
 59    * Get parsed result.
 60    *
 61    * @return LaTeX text part.
 62    */
 63  26 public final LatexVo getLatex() {
 64  26 return latex;
 65    }
 66   
 67  52 public final void startElement(final String name, final SimpleAttributes attributes)
 68    throws SyntaxException {
 69  52 if (getStartTag().equals(name)) {
 70    // ignore
 71  26 } else if ("LATEX".equals(name)) {
 72  26 this.data = null;
 73  26 language = attributes.getString("language");
 74    } else {
 75  0 throw SyntaxException.createUnexpectedTagException(name);
 76    }
 77    }
 78   
 79  52 public void endElement(final String name) throws SyntaxException {
 80  52 if (getStartTag().equals(name)) {
 81    // ignore
 82  26 } else if ("LATEX".equals(name)) {
 83  26 latex = new LatexVo(language, data);
 84    } else {
 85  0 throw SyntaxException.createUnexpectedTagException(name);
 86    }
 87    }
 88   
 89  26 public void characters(final String name, final String data) throws SyntaxException {
 90  26 if (getStartTag().equals(name)) {
 91    // ignore
 92  26 } else if ("LATEX".equals(name)) {
 93  26 this.data = data;
 94    } else {
 95  0 throw SyntaxException.createUnexpectedTextDataException(name, data);
 96    }
 97    }
 98   
 99    }