Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: So Sep 2 2007 02:40:58 CEST
file stats: LOC: 101   Methods: 5
NCLOC: 50   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ChapterHandler.java 87,5% 91,7% 100% 91,1%
coverage coverage
 1    /* $Id: ChapterHandler.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.ChapterVo;
 22    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 23    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 24   
 25    /**
 26    * Handles a chapter.
 27    *
 28    * @version $Revision: 1.13 $
 29    * @author Michael Meyling
 30    */
 31    public class ChapterHandler extends AbstractSimpleHandler {
 32   
 33    /** Handles chapter title information. */
 34    private final LatexListHandler titleHandler;
 35   
 36    /** Handles chapter introduction. */
 37    private final LatexListHandler introductionHandler;
 38   
 39    /** Handles sections. */
 40    private final SectionHandler sectionHandler;
 41   
 42    /** Chapter value object. */
 43    private ChapterVo chapter;
 44   
 45    /**
 46    * Constructor.
 47    *
 48    * @param handler Parent handler.
 49    */
 50  63 public ChapterHandler(final AbstractSimpleHandler handler) {
 51  63 super(handler, "CHAPTER");
 52  63 titleHandler = new LatexListHandler(this, "TITLE");
 53  63 introductionHandler = new LatexListHandler(this, "INTRODUCTION");
 54  63 sectionHandler = new SectionHandler(this);
 55    }
 56   
 57  160 public void init() {
 58  160 chapter = null;
 59    }
 60   
 61    /**
 62    * Get parsed chapter.
 63    *
 64    * @return Chapter.
 65    */
 66  160 public final ChapterVo getChapter() {
 67  160 return chapter;
 68    }
 69   
 70  756 public final void startElement(final String name, final SimpleAttributes attributes)
 71    throws SyntaxException {
 72  756 if (getStartTag().equals(name)) {
 73  160 chapter = new ChapterVo();
 74  160 chapter.setNoNumber(attributes.getBoolean("noNumber"));
 75  596 } else if (titleHandler.getStartTag().equals(name)) {
 76  160 changeHandler(titleHandler, name, attributes);
 77  436 } else if (introductionHandler.getStartTag().equals(name)) {
 78  151 changeHandler(introductionHandler, name, attributes);
 79  285 } else if (sectionHandler.getStartTag().equals(name)) {
 80  285 changeHandler(sectionHandler, name, attributes);
 81    } else {
 82  0 throw SyntaxException.createUnexpectedTagException(name);
 83    }
 84    }
 85   
 86  756 public final void endElement(final String name) throws SyntaxException {
 87  756 if (getStartTag().equals(name)) {
 88    // nothing to do
 89  596 } else if (titleHandler.getStartTag().equals(name)) {
 90  160 chapter.setTitle(titleHandler.getLatexList());
 91  436 } else if (introductionHandler.getStartTag().equals(name)) {
 92  151 chapter.setIntroduction(introductionHandler.getLatexList());
 93  285 } else if (sectionHandler.getStartTag().equals(name)) {
 94  285 chapter.addSection(sectionHandler.getSection());
 95    } else {
 96  0 throw SyntaxException.createUnexpectedTagException(name);
 97    }
 98    }
 99   
 100   
 101    }