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