Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 85   Methods: 5
NCLOC: 36   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
UsedByListHandler.java 75% 83,3% 100% 84%
coverage coverage
 1    /* $Id: UsedByListHandler.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.UsedByListVo;
 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    /**
 27    * Parse list of referencing modules.
 28    *
 29    * @version $Revision: 1.10 $
 30    * @author Michael Meyling
 31    */
 32    public final class UsedByListHandler extends AbstractSimpleHandler {
 33   
 34    /** Value object for the "this module is used by" list. */
 35    private UsedByListVo list;
 36   
 37    /** Handler for a single module specification. */
 38    private final SpecificationHandler specificationHandler;
 39   
 40   
 41    /**
 42    * Handles list of modules that use the current one.
 43    *
 44    * @param handler Parent handler.
 45    */
 46  27 public UsedByListHandler(final AbstractSimpleHandler handler) {
 47  27 super(handler, "USEDBY");
 48  27 specificationHandler = new SpecificationHandler(this);
 49    }
 50   
 51  15 public final void init() {
 52  15 list = new UsedByListVo();
 53    }
 54   
 55    /**
 56    * Get parsed result.
 57    *
 58    * @return Location list.
 59    */
 60  15 public final UsedByListVo getUsedByList() {
 61  15 return list;
 62    }
 63   
 64  30 public final void startElement(final String name, final SimpleAttributes attributes)
 65    throws SyntaxException {
 66  30 if (getStartTag().equals(name)) {
 67    // ignore
 68  15 } else if (specificationHandler.getStartTag().equals(name)) {
 69  15 changeHandler(specificationHandler, name, attributes);
 70    } else {
 71  0 throw SyntaxException.createUnexpectedTagException(name);
 72    }
 73    }
 74   
 75  30 public final void endElement(final String name) throws SyntaxException {
 76  30 if (getStartTag().equals(name)) {
 77    // ignore
 78  15 } else if (specificationHandler.getStartTag().equals(name)) {
 79  15 list.add(specificationHandler.getSpecification());
 80    } else {
 81  0 throw SyntaxException.createUnexpectedTagException(name);
 82    }
 83    }
 84   
 85    }