Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
23   101   13   4,6
16   49   0,57   5
5     2,6  
1    
 
  PropositionHandler       Line # 32 23 13 90,9% 0.90909094
 
  (41)
 
1    /* $Id: PropositionHandler.java,v 1.1 2008/07/26 08:00:51 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, 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.PropositionVo;
21    import org.qedeq.kernel.xml.common.XmlSyntaxException;
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.1 $
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  140 toggle public PropositionHandler(final AbstractSimpleHandler handler) {
53  140 super(handler, "THEOREM");
54  140 formulaHandler = new FormulaHandler(this);
55  140 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
56  140 proofHandler = new ProofHandler(this);
57    }
58   
 
59  513 toggle public final void init() {
60  513 proposition = null;
61    }
62   
63    /**
64    * Get proposition.
65    *
66    * @return Proposition.
67    */
 
68  513 toggle public final PropositionVo getProposition() {
69  513 return proposition;
70    }
71   
 
72  1130 toggle public final void startElement(final String name, final SimpleAttributes attributes)
73    throws XmlSyntaxException {
74  1130 if (getStartTag().equals(name)) {
75  513 proposition = new PropositionVo();
76  617 } else if (formulaHandler.getStartTag().equals(name)) {
77  513 changeHandler(formulaHandler, name, attributes);
78  104 } else if (descriptionHandler.getStartTag().equals(name)) {
79  8 changeHandler(descriptionHandler, name, attributes);
80  96 } else if (proofHandler.getStartTag().equals(name)) {
81  96 changeHandler(proofHandler, name, attributes);
82    } else {
83  0 throw XmlSyntaxException.createUnexpectedTagException(name);
84    }
85    }
86   
 
87  1130 toggle public final void endElement(final String name) throws XmlSyntaxException {
88  1130 if (getStartTag().equals(name)) {
89    // nothing to do
90  617 } else if (formulaHandler.getStartTag().equals(name)) {
91  513 proposition.setFormula(formulaHandler.getFormula());
92  104 } else if (descriptionHandler.getStartTag().equals(name)) {
93  8 proposition.setDescription(descriptionHandler.getLatexList());
94  96 } else if (proofHandler.getStartTag().equals(name)) {
95  96 proposition.addProof(proofHandler.getProof());
96    } else {
97  0 throw XmlSyntaxException.createUnexpectedTagException(name);
98    }
99    }
100   
101    }