Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 96   Methods: 6
NCLOC: 43   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LatexHandler.java 66,7% 78,6% 100% 78,1%
coverage coverage
 1    /* $Id: LatexHandler.java,v 1.7 2005/08/19 04:13:28 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2005, 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.base.module.Latex;
 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    import org.qedeq.kernel.xml.parser.SyntaxException;
 25   
 26   
 27    /**
 28    * Parse header informations.
 29    *
 30    * @version $Revision: 1.7 $
 31    * @author Michael Meyling
 32    */
 33    public final class LatexHandler extends AbstractSimpleHandler {
 34   
 35    /** Text language. */
 36    private String language;
 37   
 38    /** LaTeX text. */
 39    private Latex latex;
 40   
 41   
 42    /**
 43    * Handles LaTeX tags.
 44    *
 45    * @param handler Handler that uses this handler.
 46    * @param startTag This is the starting tag.
 47    */
 48  17 public LatexHandler(final AbstractSimpleHandler handler, final String startTag) {
 49  17 super(handler, startTag);
 50    }
 51   
 52  16 public final void init() {
 53  16 latex = null;
 54    }
 55   
 56    /**
 57    * Get parsed result.
 58    *
 59    * @return LaTeX text part.
 60    */
 61  16 public final Latex getLatex() {
 62  16 return latex;
 63    }
 64   
 65  32 public final void startElement(final String name, final SimpleAttributes attributes)
 66    throws SyntaxException {
 67  32 if (getStartTag().equals(name)) {
 68    // ignore
 69  16 } else if ("LATEX".equals(name)) {
 70  16 language = attributes.getString("language");
 71    } else {
 72  0 throw SyntaxException.createUnexpectedTagException(name);
 73    }
 74    }
 75   
 76  32 public void endElement(final String name) throws SyntaxException {
 77  32 if (getStartTag().equals(name)) {
 78    // ignore
 79  16 } else if ("LATEX".equals(name)) {
 80    // do nothing
 81    } else {
 82  0 throw SyntaxException.createUnexpectedTagException(name);
 83    }
 84    }
 85   
 86  16 public void characters(final String name, final String data) throws SyntaxException {
 87  16 if (getStartTag().equals(name)) {
 88    // ignore
 89  16 } else if ("LATEX".equals(name)) {
 90  16 latex = new LatexVo(language, data);
 91    } else {
 92  0 throw SyntaxException.createUnexpectedTextDataException(name, data);
 93    }
 94    }
 95   
 96    }