Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 97   Methods: 5
NCLOC: 47   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SubsectionHandler.java 83,3% 90,5% 100% 89,5%
coverage coverage
 1    /* $Id: SubsectionHandler.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.base.module.Subsection;
 21    import org.qedeq.kernel.dto.module.SubsectionVo;
 22    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 23    import org.qedeq.kernel.xml.parser.SyntaxException;
 24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 25   
 26   
 27    /**
 28    * Parses subsection data.
 29    *
 30    * @version $Revision: 1.9 $
 31    * @author Michael Meyling
 32    */
 33    public class SubsectionHandler extends AbstractSimpleHandler {
 34   
 35    /** Handler for subsection title. */
 36    private final LatexListHandler titleHandler;
 37   
 38    /** Handler for subsection text. */
 39    private final LatexListHandler latexHandler;
 40   
 41    /** Subsection. */
 42    private SubsectionVo subsection;
 43   
 44   
 45    /**
 46    * Constructor.
 47    *
 48    * @param handler Parent handler.
 49    */
 50  27 public SubsectionHandler(final AbstractSimpleHandler handler) {
 51  27 super(handler, "SUBSECTION");
 52  27 titleHandler = new LatexListHandler(this, "TITLE");
 53  27 latexHandler = new LatexListHandler(this, "TEXT");
 54  27 subsection = new SubsectionVo();
 55    }
 56   
 57  61 public final void init() {
 58  61 subsection = null;
 59    }
 60   
 61    /**
 62    * Get subsection.
 63    *
 64    * @return Subsection.
 65    */
 66  61 public final Subsection getSubsection() {
 67  61 return subsection;
 68    }
 69   
 70  174 public final void startElement(final String name, final SimpleAttributes attributes)
 71    throws SyntaxException {
 72  174 if (getStartTag().equals(name)) {
 73  61 subsection = new SubsectionVo();
 74  61 subsection.setId(attributes.getString("label"));
 75  61 subsection.setLevel(attributes.getString("level"));
 76  113 } else if (titleHandler.getStartTag().equals(name)) {
 77  52 changeHandler(titleHandler, name, attributes);
 78  61 } else if (latexHandler.getStartTag().equals(name)) {
 79  61 changeHandler(latexHandler, name, attributes);
 80    } else {
 81  0 throw SyntaxException.createUnexpectedTagException(name);
 82    }
 83    }
 84   
 85  174 public final void endElement(final String name) throws SyntaxException {
 86  174 if (getStartTag().equals(name)) {
 87    // thats why we handle it
 88  113 } else if (titleHandler.getStartTag().equals(name)) {
 89  52 subsection.setTitle(titleHandler.getLatexList());
 90  61 } else if (latexHandler.getStartTag().equals(name)) {
 91  61 subsection.setLatex(latexHandler.getLatexList());
 92    } else {
 93  0 throw SyntaxException.createUnexpectedTagException(name);
 94    }
 95    }
 96   
 97    }