Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 96   Methods: 6
NCLOC: 45   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LatexListHandler.java 70% 80% 100% 80,6%
coverage coverage
 1    /* $Id: LatexListHandler.java,v 1.13 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.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   
 26    /**
 27    * Parse header informations.
 28    *
 29    * @version $Revision: 1.13 $
 30    * @author Michael Meyling
 31    */
 32    public class LatexListHandler extends AbstractSimpleHandler {
 33   
 34    /** Text language. */
 35    private String language;
 36   
 37    /** LaTeX text. */
 38    private LatexListVo list;
 39   
 40    /** Character data. */
 41    private String data;
 42   
 43    /**
 44    * Handles LaTeX tags.
 45    *
 46    * @param handler Handler that uses this handler.
 47    * @param startTag This is the starting tag.
 48    */
 49  920 public LatexListHandler(final AbstractSimpleHandler handler, final String startTag) {
 50  920 super(handler, startTag);
 51    }
 52   
 53  2804 public final void init() {
 54  2804 list = new LatexListVo();
 55    }
 56   
 57    /**
 58    * Get parsed result.
 59    *
 60    * @return LaTeX text parts.
 61    */
 62  2804 public final LatexListVo getLatexList() {
 63  2804 return list;
 64    }
 65   
 66  7955 public final void startElement(final String name, final SimpleAttributes attributes)
 67    throws SyntaxException {
 68  7955 if (getStartTag().equals(name)) {
 69    // ignore
 70  5151 } else if ("LATEX".equals(name)) {
 71  5151 this.data = null;
 72  5151 language = attributes.getString("language");
 73    } else {
 74  0 throw SyntaxException.createUnexpectedTagException(name);
 75    }
 76    }
 77   
 78  7955 public final void endElement(final String name) throws SyntaxException {
 79  7955 if (getStartTag().equals(name)) {
 80    // ignore
 81  5151 } else if ("LATEX".equals(name)) {
 82  5151 list.add(new LatexVo(language, data));
 83    } else {
 84  0 throw SyntaxException.createUnexpectedTagException(name);
 85    }
 86    }
 87   
 88  5137 public final void characters(final String name, final String data) {
 89  5137 if ("LATEX".equals(name)) {
 90  5137 this.data = data;
 91    } else {
 92  0 throw new RuntimeException("Unexpected character data in tag: " + name);
 93    }
 94    }
 95   
 96    }