Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 126   Methods: 5
NCLOC: 68   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
HeaderHandler.java 92,9% 94,7% 100% 94,4%
coverage coverage
 1    /* $Id: HeaderHandler.java,v 1.9 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.Header;
 21    import org.qedeq.kernel.dto.module.HeaderVo;
 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    * Parse header informations.
 29    *
 30    * @version $Revision: 1.9 $
 31    * @author Michael Meyling
 32    */
 33    public final class HeaderHandler extends AbstractSimpleHandler {
 34   
 35    /** Value object for module header. */
 36    private HeaderVo header;
 37   
 38    /** Handler for module specification. */
 39    private final SpecificationHandler specificationHandler;
 40   
 41    /** Handler for module title. */
 42    private final LatexListHandler titleHandler;
 43   
 44    /** Handler for module abstract. */
 45    private final LatexListHandler abstractHandler;
 46   
 47    /** Handler for list of module authors. */
 48    private final AuthorListHandler authorListHandler;
 49   
 50    /** Handler for list of module imports. */
 51    private final ImportListHandler importListHandler;
 52   
 53    /** Handler for list of modules that need this one. */
 54    private final UsedByListHandler usedbyListHandler;
 55   
 56   
 57    /**
 58    * Deals with header of qedeq file.
 59    *
 60    * @param handler Parent handler.
 61    */
 62  17 public HeaderHandler(final AbstractSimpleHandler handler) {
 63  17 super(handler, "HEADER");
 64  17 titleHandler = new LatexListHandler(this, "TITLE");
 65  17 abstractHandler = new LatexListHandler(this, "ABSTRACT");
 66  17 specificationHandler = new SpecificationHandler(this, "SPECIFICATION");
 67  17 authorListHandler = new AuthorListHandler(this);
 68  17 importListHandler = new ImportListHandler(this);
 69  17 usedbyListHandler = new UsedByListHandler(this);
 70    }
 71   
 72  16 public final void init() {
 73  16 header = null;
 74    }
 75   
 76    /**
 77    * Get header of qedeq module.
 78    *
 79    * @return Header of qedeq module.
 80    */
 81  16 public final Header getHeader() {
 82  16 return header;
 83    }
 84   
 85  104 public final void startElement(final String name, final SimpleAttributes attributes)
 86    throws SyntaxException {
 87  104 if (getStartTag().equals(name)) {
 88  16 header = new HeaderVo();
 89  88 } else if (specificationHandler.getStartTag().equals(name)) {
 90  16 changeHandler(specificationHandler, name, attributes);
 91  72 } else if (titleHandler.getStartTag().equals(name)) {
 92  16 changeHandler(titleHandler, name, attributes);
 93  56 } else if (abstractHandler.getStartTag().equals(name)) {
 94  16 changeHandler(abstractHandler, name, attributes);
 95  40 } else if (authorListHandler.getStartTag().equals(name)) {
 96  16 changeHandler(authorListHandler, name, attributes);
 97  24 } else if (importListHandler.getStartTag().equals(name)) {
 98  13 changeHandler(importListHandler, name, attributes);
 99  11 } else if (usedbyListHandler.getStartTag().equals(name)) {
 100  11 changeHandler(usedbyListHandler, name, attributes);
 101    } else {
 102  0 throw SyntaxException.createUnexpectedTagException(name);
 103    }
 104    }
 105   
 106  104 public final void endElement(final String name) throws SyntaxException {
 107  104 if (getStartTag().equals(name)) {
 108    // nothing to do
 109  88 } else if (specificationHandler.getStartTag().equals(name)) {
 110  16 header.setSpecification(specificationHandler.getSpecification());
 111  72 } else if (titleHandler.getStartTag().equals(name)) {
 112  16 header.setTitle(titleHandler.getLatexList());
 113  56 } else if (abstractHandler.getStartTag().equals(name)) {
 114  16 header.setSummary(abstractHandler.getLatexList());
 115  40 } else if (authorListHandler.getStartTag().equals(name)) {
 116  16 header.setAuthorList(authorListHandler.getAuthorList());
 117  24 } else if (importListHandler.getStartTag().equals(name)) {
 118  13 header.setImportList(importListHandler.getImportList());
 119  11 } else if (usedbyListHandler.getStartTag().equals(name)) {
 120  11 header.setUsedByList(usedbyListHandler.getUsedByList());
 121    } else {
 122  0 throw SyntaxException.createUnexpectedTagException(name);
 123    }
 124    }
 125   
 126    }