Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 92   Methods: 5
NCLOC: 42   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ImportListHandler.java 83,3% 87,5% 100% 87,9%
coverage coverage
 1    /* $Id: ImportListHandler.java,v 1.13 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.ImportListVo;
 22    import org.qedeq.kernel.dto.module.ImportVo;
 23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 25   
 26   
 27    /**
 28    * Parse author list.
 29    *
 30    * @version $Revision: 1.13 $
 31    * @author Michael Meyling
 32    */
 33    public class ImportListHandler extends AbstractSimpleHandler {
 34   
 35    /** Value object with list of all module imports. */
 36    private ImportListVo list;
 37   
 38    /** Handler for a single module specification. */
 39    private final SpecificationHandler specificationHandler;
 40   
 41    /** Label for a single module. */
 42    private String label;
 43   
 44   
 45    /**
 46    * Handles list of imports.
 47    *
 48    * @param handler Parent handler.
 49    */
 50  46 public ImportListHandler(final AbstractSimpleHandler handler) {
 51  46 super(handler, "IMPORTS");
 52  46 specificationHandler = new SpecificationHandler(this);
 53    }
 54   
 55  28 public final void init() {
 56  28 list = null;
 57    }
 58   
 59    /**
 60    * Get parsed result.
 61    *
 62    * @return Location list.
 63    */
 64  28 public final ImportListVo getImportList() {
 65  28 return list;
 66    }
 67   
 68  126 public final void startElement(final String name, final SimpleAttributes attributes)
 69    throws SyntaxException {
 70  126 if (getStartTag().equals(name)) {
 71  28 list = new ImportListVo();
 72  98 } else if ("IMPORT".equals(name)) {
 73  49 label = attributes.getString("label");
 74  49 } else if (specificationHandler.getStartTag().equals(name)) {
 75  49 changeHandler(specificationHandler, name, attributes);
 76    } else {
 77  0 throw SyntaxException.createUnexpectedTagException(name);
 78    }
 79    }
 80   
 81  126 public final void endElement(final String name) throws SyntaxException {
 82  126 if (getStartTag().equals(name)) {
 83    // nothing to do
 84  98 } else if (specificationHandler.getStartTag().equals(name)) {
 85    // nothing to do
 86  49 } else if ("IMPORT".equals(name)) {
 87  49 list.add(new ImportVo(label, specificationHandler.getSpecification()));
 88    } else {
 89  0 throw SyntaxException.createUnexpectedTagException(name);
 90    }
 91    }
 92    }