Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
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.9 2005/12/09 18:24:23 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2005, 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.9 $
 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  17 public PropositionHandler(final AbstractSimpleHandler handler) {
 54  17 super(handler, "THEOREM");
 55  17 formulaHandler = new FormulaOrTermHandler(this);
 56  17 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
 57  17 proofHandler = new ProofHandler(this);
 58    }
 59   
 60  19 public final void init() {
 61  19 proposition = null;
 62    }
 63   
 64    /**
 65    * Get proposition.
 66    *
 67    * @return Proposition.
 68    */
 69  19 public final Proposition getProposition() {
 70  19 return proposition;
 71    }
 72   
 73  58 public final void startElement(final String name, final SimpleAttributes attributes)
 74    throws SyntaxException {
 75  58 if (getStartTag().equals(name)) {
 76  19 proposition = new PropositionVo();
 77  39 } else if (formulaHandler.getStartTag().equals(name)) {
 78  19 changeHandler(formulaHandler, name, attributes);
 79  20 } else if (descriptionHandler.getStartTag().equals(name)) {
 80  2 changeHandler(descriptionHandler, name, attributes);
 81  18 } else if (proofHandler.getStartTag().equals(name)) {
 82  18 changeHandler(proofHandler, name, attributes);
 83    } else {
 84  0 throw SyntaxException.createUnexpectedTagException(name);
 85    }
 86    }
 87   
 88  58 public final void endElement(final String name) throws SyntaxException {
 89  58 if (getStartTag().equals(name)) {
 90    // nothing to do
 91  39 } else if (formulaHandler.getStartTag().equals(name)) {
 92  19 proposition.setFormula(formulaHandler.getFormulaOrTerm());
 93  20 } else if (descriptionHandler.getStartTag().equals(name)) {
 94  2 proposition.setDescription(descriptionHandler.getLatexList());
 95  18 } else if (proofHandler.getStartTag().equals(name)) {
 96  18 proposition.addProof(proofHandler.getProof());
 97    } else {
 98  0 throw SyntaxException.createUnexpectedTagException(name);
 99    }
 100    }
 101   
 102    }