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