Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 83   Methods: 5
NCLOC: 36   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FormulaHandler.java 75% 83,3% 100% 84%
coverage coverage
 1    /* $Id: FormulaHandler.java,v 1.4 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.FormulaVo;
 22    import org.qedeq.kernel.xml.handler.list.ElementHandler;
 23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 25   
 26   
 27    /**
 28    * Parse formula.
 29    *
 30    * @version $Revision: 1.4 $
 31    * @author Michael Meyling
 32    */
 33    public class FormulaHandler extends AbstractSimpleHandler {
 34   
 35    /** Value object for formula. */
 36    private FormulaVo formula;
 37   
 38    /** Handles {@link org.qedeq.kernel.base.list.Element}s. */
 39    private final ElementHandler elementHandler;
 40   
 41   
 42    /**
 43    * Handles formulas.
 44    *
 45    * @param handler Parent handler.
 46    */
 47  138 public FormulaHandler(final AbstractSimpleHandler handler) {
 48  138 super(handler, "FORMULA");
 49  138 elementHandler = new ElementHandler(this);
 50    }
 51   
 52  592 public final void init() {
 53  592 formula = null;
 54    }
 55   
 56    /**
 57    * Get parsed result.
 58    *
 59    * @return FormulaOrTerm.
 60    */
 61  592 public final FormulaVo getFormula() {
 62  592 return formula;
 63    }
 64   
 65  1184 public final void startElement(final String name, final SimpleAttributes attributes)
 66    throws SyntaxException {
 67  1184 if (getStartTag().equals(name)) {
 68    // nothing to do
 69  592 } else if (getLevel() > 1) {
 70  592 changeHandler(elementHandler, name, attributes);
 71    } else {
 72  0 throw SyntaxException.createUnexpectedTagException(name);
 73    }
 74    }
 75   
 76  1184 public final void endElement(final String name) throws SyntaxException {
 77  1184 if (getStartTag().equals(name)) {
 78  592 formula = new FormulaVo(elementHandler.getElement());
 79  592 } else if (getLevel() <= 1) {
 80  0 throw SyntaxException.createUnexpectedTagException(name);
 81    }
 82    }
 83    }