Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 83   Methods: 5
NCLOC: 36   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.dto.module.AuthorListVo;
 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.10 $
 29    * @author Michael Meyling
 30    */
 31    public final class AuthorListHandler extends AbstractSimpleHandler {
 32   
 33    /** List of authors. */
 34    private AuthorListVo list;
 35   
 36    /** Parses an author. */
 37    private final AuthorHandler authorHandler;
 38   
 39   
 40    /**
 41    * Handles list of authors.
 42    *
 43    * @param handler Parent handler.
 44    */
 45  27 public AuthorListHandler(final AbstractSimpleHandler handler) {
 46  27 super(handler, "AUTHORS");
 47  27 authorHandler = new AuthorHandler(this);
 48    }
 49   
 50  26 public final void init() {
 51  26 list = new AuthorListVo();
 52    }
 53   
 54    /**
 55    * Get list of authors.
 56    *
 57    * @return Author list.
 58    */
 59  26 public final AuthorListVo getAuthorList() {
 60  26 return list;
 61    }
 62   
 63  52 public final void startElement(final String name, final SimpleAttributes attributes)
 64    throws SyntaxException {
 65  52 if (getStartTag().equals(name)) {
 66    // nothing to do
 67  26 } else if (authorHandler.getStartTag().equals(name)) {
 68  26 changeHandler(authorHandler, name, attributes);
 69    } else {
 70  0 throw SyntaxException.createUnexpectedTagException(name);
 71    }
 72    }
 73   
 74  52 public final void endElement(final String name) throws SyntaxException {
 75  52 if (getStartTag().equals(name)) {
 76    // nothing to do
 77  26 } else if (authorHandler.getStartTag().equals(name)) {
 78  26 list.add(authorHandler.getAuthor());
 79    } else {
 80  0 throw SyntaxException.createUnexpectedTagException(name);
 81    }
 82    }
 83    }