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