Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../../../img/srcFileCovDistChart9.png 34% of files have more coverage
23   99   13   4.6
16   49   0.57   5
5     2.6  
1    
 
  PropositionHandler       Line # 30 23 13 90.9% 0.90909094
 
  (55)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2010, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.xml.handler.module;
17   
18    import org.qedeq.kernel.dto.module.PropositionVo;
19    import org.qedeq.kernel.xml.common.XmlSyntaxException;
20    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
21    import org.qedeq.kernel.xml.parser.SimpleAttributes;
22   
23   
24    /**
25    * Parse a proposition.
26    *
27    * @version $Revision: 1.1 $
28    * @author Michael Meyling
29    */
 
30    public class PropositionHandler extends AbstractSimpleHandler {
31   
32    /** Handler for proposition formula. */
33    private final FormulaHandler formulaHandler;
34   
35    /** Handler for rule description. */
36    private final LatexListHandler descriptionHandler;
37   
38    /** Handle proofs. */
39    private final ProofHandler proofHandler;
40   
41    /** Proposition value object. */
42    private PropositionVo proposition;
43   
44   
45    /**
46    * Deals with propositions.
47    *
48    * @param handler Parent handler.
49    */
 
50  177 toggle public PropositionHandler(final AbstractSimpleHandler handler) {
51  177 super(handler, "THEOREM");
52  177 formulaHandler = new FormulaHandler(this);
53  177 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
54  177 proofHandler = new ProofHandler(this);
55    }
56   
 
57  534 toggle public final void init() {
58  534 proposition = null;
59    }
60   
61    /**
62    * Get proposition.
63    *
64    * @return Proposition.
65    */
 
66  534 toggle public final PropositionVo getProposition() {
67  534 return proposition;
68    }
69   
 
70  1240 toggle public final void startElement(final String name, final SimpleAttributes attributes)
71    throws XmlSyntaxException {
72  1240 if (getStartTag().equals(name)) {
73  534 proposition = new PropositionVo();
74  706 } else if (formulaHandler.getStartTag().equals(name)) {
75  534 changeHandler(formulaHandler, name, attributes);
76  172 } else if (descriptionHandler.getStartTag().equals(name)) {
77  8 changeHandler(descriptionHandler, name, attributes);
78  164 } else if (proofHandler.getStartTag().equals(name)) {
79  164 changeHandler(proofHandler, name, attributes);
80    } else {
81  0 throw XmlSyntaxException.createUnexpectedTagException(name);
82    }
83    }
84   
 
85  1240 toggle public final void endElement(final String name) throws XmlSyntaxException {
86  1240 if (getStartTag().equals(name)) {
87    // nothing to do
88  706 } else if (formulaHandler.getStartTag().equals(name)) {
89  534 proposition.setFormula(formulaHandler.getFormula());
90  172 } else if (descriptionHandler.getStartTag().equals(name)) {
91  8 proposition.setDescription(descriptionHandler.getLatexList());
92  164 } else if (proofHandler.getStartTag().equals(name)) {
93  164 proposition.addProof(proofHandler.getProof());
94    } else {
95  0 throw XmlSyntaxException.createUnexpectedTagException(name);
96    }
97    }
98   
99    }