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