Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 89   Methods: 5
NCLOC: 38   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LiteratureItemHandler.java 50% 83,3% 100% 81%
coverage coverage
 1    /* $Id: LiteratureItemHandler.java,v 1.1 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.LiteratureItem;
 21    import org.qedeq.kernel.dto.module.LiteratureItemVo;
 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    /**
 28    * Handle bibliography entry.
 29    *
 30    * @version $Revision: 1.1 $
 31    * @author Michael Meyling
 32    */
 33    public final class LiteratureItemHandler extends AbstractSimpleHandler {
 34   
 35    /** Tag for this handler. */
 36    public static final String ITEM_TAG = "ITEM";
 37   
 38    /** Handle reference texts. */
 39    private final LatexListHandler itemHandler;
 40   
 41    /** Value object. */
 42    private LiteratureItemVo literatureItem;
 43   
 44   
 45    /**
 46    * Constructor.
 47    *
 48    * @param handler
 49    * Parent handler.
 50    */
 51  25 public LiteratureItemHandler(final AbstractSimpleHandler handler) {
 52  25 super(handler, ITEM_TAG);
 53  25 itemHandler = new LatexListHandler(this, ITEM_TAG);
 54    }
 55   
 56  27 public final void init() {
 57  27 literatureItem = null;
 58    }
 59   
 60    /**
 61    * Get section.
 62    *
 63    * @return Section.
 64    */
 65  27 public final LiteratureItem getLiteratureItem() {
 66  27 return literatureItem;
 67    }
 68   
 69  27 public final void startElement(final String name, final SimpleAttributes attributes)
 70    throws SyntaxException {
 71  27 if (getStartTag().equals(name)) {
 72  27 literatureItem = new LiteratureItemVo();
 73  27 literatureItem.setLabel(attributes.getString("label"));
 74  27 changeHandler(itemHandler, name, attributes);
 75    } else {
 76  0 throw SyntaxException.createUnexpectedTagException(name);
 77    }
 78    }
 79   
 80  27 public final void endElement(final String name) throws SyntaxException {
 81  27 if (getStartTag().equals(name)) {
 82  27 literatureItem.setItem(itemHandler.getLatexList());
 83    } else {
 84  0 throw SyntaxException.createUnexpectedTagException(name);
 85    }
 86    }
 87   
 88   
 89    }