Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
28   107   15   5.6
20   55   0.54   5
5     3  
1    
 
  PropositionHandler       Line # 30 28 15 92.5% 0.9245283
 
  (102)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, 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.se.dto.module.PropositionVo;
19    import org.qedeq.kernel.xml.common.XmlSyntaxException;
20    import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
21    import org.qedeq.kernel.xml.handler.common.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 informal proofs. */
39    private final ProofHandler proofHandler;
40   
41    /** Handle formal proofs. */
42    private final FormalProofHandler formalProofHandler;
43   
44    /** Proposition value object. */
45    private PropositionVo proposition;
46   
47   
48    /**
49    * Deals with propositions.
50    *
51    * @param handler Parent handler.
52    */
 
53  614 toggle public PropositionHandler(final AbstractSimpleHandler handler) {
54  614 super(handler, "THEOREM");
55  614 formulaHandler = new FormulaHandler(this);
56  614 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
57  614 proofHandler = new ProofHandler(this);
58  614 formalProofHandler = new FormalProofHandler(this);
59    }
60   
 
61  9667 toggle public final void init() {
62  9667 proposition = null;
63    }
64   
65    /**
66    * Get proposition.
67    *
68    * @return Proposition.
69    */
 
70  9667 toggle public final PropositionVo getProposition() {
71  9667 return proposition;
72    }
73   
 
74  22980 toggle public final void startElement(final String name, final SimpleAttributes attributes)
75    throws XmlSyntaxException {
76  22980 if (getStartTag().equals(name)) {
77  9667 proposition = new PropositionVo();
78  13313 } else if (formulaHandler.getStartTag().equals(name)) {
79  9667 changeHandler(formulaHandler, name, attributes);
80  3646 } else if (descriptionHandler.getStartTag().equals(name)) {
81  161 changeHandler(descriptionHandler, name, attributes);
82  3485 } else if (proofHandler.getStartTag().equals(name)) {
83  2944 changeHandler(proofHandler, name, attributes);
84  541 } else if (formalProofHandler.getStartTag().equals(name)) {
85  541 changeHandler(formalProofHandler, name, attributes);
86    } else {
87  0 throw XmlSyntaxException.createUnexpectedTagException(name);
88    }
89    }
90   
 
91  22980 toggle public final void endElement(final String name) throws XmlSyntaxException {
92  22980 if (getStartTag().equals(name)) {
93    // nothing to do
94  13313 } else if (formulaHandler.getStartTag().equals(name)) {
95  9667 proposition.setFormula(formulaHandler.getFormula());
96  3646 } else if (descriptionHandler.getStartTag().equals(name)) {
97  161 proposition.setDescription(descriptionHandler.getLatexList());
98  3485 } else if (proofHandler.getStartTag().equals(name)) {
99  2944 proposition.addProof(proofHandler.getProof());
100  541 } else if (formalProofHandler.getStartTag().equals(name)) {
101  541 proposition.addFormalProof(formalProofHandler.getProof());
102    } else {
103  0 throw XmlSyntaxException.createUnexpectedTagException(name);
104    }
105    }
106   
107    }