Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 88   Methods: 5
NCLOC: 40   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AuthorHandler.java 75% 85,7% 100% 85,2%
coverage coverage
 1    /* $Id: AuthorHandler.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.Author;
 21    import org.qedeq.kernel.dto.module.AuthorVo;
 22    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 23    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 24    import org.qedeq.kernel.xml.parser.SyntaxException;
 25   
 26    /**
 27    * Parse author list.
 28    *
 29    * @version $Revision: 1.2 $
 30    * @author Michael Meyling
 31    */
 32    public final class AuthorHandler extends AbstractSimpleHandler {
 33   
 34    /** Author. */
 35    private AuthorVo author;
 36   
 37    /** Email address of one author. */
 38    private String email;
 39   
 40    /** Parses the name of the author. */
 41    private final LatexHandler authorNameHandler;
 42   
 43   
 44    /**
 45    * Handles list of authors.
 46    *
 47    * @param handler Parent handler.
 48    */
 49  17 public AuthorHandler(final AbstractSimpleHandler handler) {
 50  17 super(handler, "AUTHOR");
 51  17 authorNameHandler = new LatexHandler(this, "NAME");
 52    }
 53   
 54  16 public final void init() {
 55  16 author = null;
 56  16 email = null;
 57    }
 58   
 59    /**
 60    * Get author.
 61    *
 62    * @return Author.
 63    */
 64  16 public final Author getAuthor() {
 65  16 return author;
 66    }
 67   
 68  32 public final void startElement(final String name, final SimpleAttributes attributes)
 69    throws SyntaxException {
 70  32 if (getStartTag().equals(name)) {
 71  16 email = attributes.getString("email");
 72  16 } else if (authorNameHandler.getStartTag().equals(name)) {
 73  16 changeHandler(authorNameHandler, name, attributes);
 74    } else {
 75  0 throw SyntaxException.createUnexpectedTagException(name);
 76    }
 77    }
 78   
 79  32 public final void endElement(final String name) throws SyntaxException {
 80  32 if (getStartTag().equals(name)) {
 81    // nothing to do
 82  16 } else if (authorNameHandler.getStartTag().equals(name)) {
 83  16 author = new AuthorVo(authorNameHandler.getLatex(), email);
 84    } else {
 85  0 throw SyntaxException.createUnexpectedTagException(name);
 86    }
 87    }
 88    }