Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
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.9 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.LatexListVo;
 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    * Parse header informations.
 28    *
 29    * @version $Revision: 1.9 $
 30    * @author Michael Meyling
 31    */
 32    public final 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  540 public LatexListHandler(final AbstractSimpleHandler handler, final String startTag) {
 50  540 super(handler, startTag);
 51    }
 52   
 53  1455 public final void init() {
 54  1455 list = new LatexListVo();
 55    }
 56   
 57    /**
 58    * Get parsed result.
 59    *
 60    * @return LaTeX text parts.
 61    */
 62  1455 public final LatexListVo getLatexList() {
 63  1455 return list;
 64    }
 65   
 66  4054 public final void startElement(final String name, final SimpleAttributes attributes)
 67    throws SyntaxException {
 68  4054 if (getStartTag().equals(name)) {
 69    // ignore
 70  2599 } else if ("LATEX".equals(name)) {
 71  2599 this.data = null;
 72  2599 language = attributes.getString("language");
 73    } else {
 74  0 throw SyntaxException.createUnexpectedTagException(name);
 75    }
 76    }
 77   
 78  4054 public final void endElement(final String name) throws SyntaxException {
 79  4054 if (getStartTag().equals(name)) {
 80    // ignore
 81  2599 } else if ("LATEX".equals(name)) {
 82  2599 list.add(new LatexVo(language, data));
 83    } else {
 84  0 throw SyntaxException.createUnexpectedTagException(name);
 85    }
 86    }
 87   
 88  2581 public final void characters(final String name, final String data) {
 89  2581 if ("LATEX".equals(name)) {
 90  2581 this.data = data;
 91    } else {
 92  0 throw new RuntimeException("Unexpected character data in tag: " + name);
 93    }
 94    }
 95   
 96    }