Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 92   Methods: 5
NCLOC: 43   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SubsectionListHandler.java 83,3% 88,2% 100% 88,2%
coverage coverage
 1    /* $Id: SubsectionListHandler.java,v 1.2 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.SubsectionList;
 21    import org.qedeq.kernel.dto.module.SubsectionListVo;
 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    * Parse subsection list.
 28    *
 29    * @version $Revision: 1.2 $
 30    * @author Michael Meyling
 31    */
 32    public final class SubsectionListHandler extends AbstractSimpleHandler {
 33   
 34    /** List of subsections. */
 35    private SubsectionListVo list;
 36   
 37    /** Parses an subsection. */
 38    private final SubsectionHandler subsectionHandler;
 39   
 40    /** Handle single node of a section. */
 41    private final NodeHandler nodeHandler;
 42   
 43   
 44    /**
 45    * Handles list of subsections.
 46    *
 47    * @param handler Parent handler.
 48    */
 49  17 public SubsectionListHandler(final AbstractSimpleHandler handler) {
 50  17 super(handler, "SUBSECTIONS");
 51  17 subsectionHandler = new SubsectionHandler(this);
 52  17 nodeHandler = new NodeHandler(this);
 53    }
 54   
 55  19 public final void init() {
 56  19 list = new SubsectionListVo();
 57    }
 58   
 59    /**
 60    * Get list of subsections.
 61    *
 62    * @return Subsection list.
 63    */
 64  19 public final SubsectionList getSubsectionList() {
 65  19 return list;
 66    }
 67   
 68  113 public final void startElement(final String name, final SimpleAttributes attributes)
 69    throws SyntaxException {
 70  113 if (getStartTag().equals(name)) {
 71    // nothing to do
 72  94 } else if (subsectionHandler.getStartTag().equals(name)) {
 73  30 changeHandler(subsectionHandler, name, attributes);
 74  64 } else if (nodeHandler.getStartTag().equals(name)) {
 75  64 changeHandler(nodeHandler, name, attributes);
 76    } else {
 77  0 throw SyntaxException.createUnexpectedTagException(name);
 78    }
 79    }
 80   
 81  113 public final void endElement(final String name) throws SyntaxException {
 82  113 if (getStartTag().equals(name)) {
 83    // nothing to do
 84  94 } else if (subsectionHandler.getStartTag().equals(name)) {
 85  30 list.add(subsectionHandler.getSubsection());
 86  64 } else if (nodeHandler.getStartTag().equals(name)) {
 87  64 list.add(nodeHandler.getNode());
 88    } else {
 89  0 throw SyntaxException.createUnexpectedTagException(name);
 90    }
 91    }
 92    }