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