Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 84   Methods: 5
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AuthorListHandler.java 75% 83,3% 100% 84%
coverage coverage
 1    /* $Id: AuthorListHandler.java,v 1.10 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.base.module.AuthorList;
 21    import org.qedeq.kernel.dto.module.AuthorListVo;
 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    * Parse author list.
 28    *
 29    * @version $Revision: 1.10 $
 30    * @author Michael Meyling
 31    */
 32    public final class AuthorListHandler extends AbstractSimpleHandler {
 33   
 34    /** List of authors. */
 35    private AuthorListVo list;
 36   
 37    /** Parses an author. */
 38    private final AuthorHandler authorHandler;
 39   
 40   
 41    /**
 42    * Handles list of authors.
 43    *
 44    * @param handler Parent handler.
 45    */
 46  25 public AuthorListHandler(final AbstractSimpleHandler handler) {
 47  25 super(handler, "AUTHORS");
 48  25 authorHandler = new AuthorHandler(this);
 49    }
 50   
 51  24 public final void init() {
 52  24 list = new AuthorListVo();
 53    }
 54   
 55    /**
 56    * Get list of authors.
 57    *
 58    * @return Author list.
 59    */
 60  24 public final AuthorList getAuthorList() {
 61  24 return list;
 62    }
 63   
 64  48 public final void startElement(final String name, final SimpleAttributes attributes)
 65    throws SyntaxException {
 66  48 if (getStartTag().equals(name)) {
 67    // nothing to do
 68  24 } else if (authorHandler.getStartTag().equals(name)) {
 69  24 changeHandler(authorHandler, name, attributes);
 70    } else {
 71  0 throw SyntaxException.createUnexpectedTagException(name);
 72    }
 73    }
 74   
 75  48 public final void endElement(final String name) throws SyntaxException {
 76  48 if (getStartTag().equals(name)) {
 77    // nothing to do
 78  24 } else if (authorHandler.getStartTag().equals(name)) {
 79  24 list.add(authorHandler.getAuthor());
 80    } else {
 81  0 throw SyntaxException.createUnexpectedTagException(name);
 82    }
 83    }
 84    }