Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 93   Methods: 6
NCLOC: 43   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LatexListHandler.java 70% 76,9% 100% 79,3%
coverage coverage
 1    /* $Id: LatexListHandler.java,v 1.8 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.LatexList;
 21    import org.qedeq.kernel.dto.module.LatexListVo;
 22    import org.qedeq.kernel.dto.module.LatexVo;
 23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 25    import org.qedeq.kernel.xml.parser.SyntaxException;
 26   
 27    /**
 28    * Parse header informations.
 29    *
 30    * @version $Revision: 1.8 $
 31    * @author Michael Meyling
 32    */
 33    public final class LatexListHandler extends AbstractSimpleHandler {
 34   
 35    /** Text language. */
 36    private String language;
 37   
 38    /** LaTeX text. */
 39    private LatexListVo list;
 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  306 public LatexListHandler(final AbstractSimpleHandler handler, final String startTag) {
 48  306 super(handler, startTag);
 49    }
 50   
 51  457 public final void init() {
 52  457 list = new LatexListVo();
 53    }
 54   
 55    /**
 56    * Get parsed result.
 57    *
 58    * @return LaTeX text parts.
 59    */
 60  457 public final LatexList getLatexList() {
 61  457 return list;
 62    }
 63   
 64  1215 public final void startElement(final String name, final SimpleAttributes attributes)
 65    throws SyntaxException {
 66  1215 if (getStartTag().equals(name)) {
 67    // ignore
 68  758 } else if ("LATEX".equals(name)) {
 69  758 language = attributes.getString("language");
 70    } else {
 71  0 throw SyntaxException.createUnexpectedTagException(name);
 72    }
 73    }
 74   
 75  1215 public final void endElement(final String name) throws SyntaxException {
 76  1215 if (getStartTag().equals(name)) {
 77    // ignore
 78  758 } else if ("LATEX".equals(name)) {
 79    // do nothing
 80    } else {
 81  0 throw SyntaxException.createUnexpectedTagException(name);
 82    }
 83    }
 84   
 85  758 public final void characters(final String name, final String data) {
 86  758 if ("LATEX".equals(name)) {
 87  758 list.add(new LatexVo(language, data));
 88    } else {
 89  0 throw new RuntimeException("Unexpected character data in tag: " + name);
 90    }
 91    }
 92   
 93    }