Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 101   Methods: 5
NCLOC: 49   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PropositionHandler.java 87,5% 91,3% 100% 90,9%
coverage coverage
 1    /* $Id: PropositionHandler.java,v 1.14 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.PropositionVo;
 22    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 23    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 24   
 25   
 26    /**
 27    * Parse a proposition.
 28    *
 29    * @version $Revision: 1.14 $
 30    * @author Michael Meyling
 31    */
 32    public class PropositionHandler extends AbstractSimpleHandler {
 33   
 34    /** Handler for proposition formula. */
 35    private final FormulaHandler formulaHandler;
 36   
 37    /** Handler for rule description. */
 38    private final LatexListHandler descriptionHandler;
 39   
 40    /** Handle proofs. */
 41    private final ProofHandler proofHandler;
 42   
 43    /** Proposition value object. */
 44    private PropositionVo proposition;
 45   
 46   
 47    /**
 48    * Deals with propositions.
 49    *
 50    * @param handler Parent handler.
 51    */
 52  46 public PropositionHandler(final AbstractSimpleHandler handler) {
 53  46 super(handler, "THEOREM");
 54  46 formulaHandler = new FormulaHandler(this);
 55  46 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
 56  46 proofHandler = new ProofHandler(this);
 57    }
 58   
 59  395 public final void init() {
 60  395 proposition = null;
 61    }
 62   
 63    /**
 64    * Get proposition.
 65    *
 66    * @return Proposition.
 67    */
 68  395 public final PropositionVo getProposition() {
 69  395 return proposition;
 70    }
 71   
 72  845 public final void startElement(final String name, final SimpleAttributes attributes)
 73    throws SyntaxException {
 74  845 if (getStartTag().equals(name)) {
 75  395 proposition = new PropositionVo();
 76  450 } else if (formulaHandler.getStartTag().equals(name)) {
 77  395 changeHandler(formulaHandler, name, attributes);
 78  55 } else if (descriptionHandler.getStartTag().equals(name)) {
 79  7 changeHandler(descriptionHandler, name, attributes);
 80  48 } else if (proofHandler.getStartTag().equals(name)) {
 81  48 changeHandler(proofHandler, name, attributes);
 82    } else {
 83  0 throw SyntaxException.createUnexpectedTagException(name);
 84    }
 85    }
 86   
 87  845 public final void endElement(final String name) throws SyntaxException {
 88  845 if (getStartTag().equals(name)) {
 89    // nothing to do
 90  450 } else if (formulaHandler.getStartTag().equals(name)) {
 91  395 proposition.setFormula(formulaHandler.getFormula());
 92  55 } else if (descriptionHandler.getStartTag().equals(name)) {
 93  7 proposition.setDescription(descriptionHandler.getLatexList());
 94  48 } else if (proofHandler.getStartTag().equals(name)) {
 95  48 proposition.addProof(proofHandler.getProof());
 96    } else {
 97  0 throw SyntaxException.createUnexpectedTagException(name);
 98    }
 99    }
 100   
 101    }