Clover Coverage Report
Coverage timestamp: Fri Feb 14 2014 01:49:02 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
 
  (4)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2014, 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  147 toggle public PropositionHandler(final AbstractSimpleHandler handler) {
54  147 super(handler, "THEOREM");
55  147 formulaHandler = new FormulaHandler(this);
56  147 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
57  147 proofHandler = new ProofHandler(this);
58  147 formalProofHandler = new FormalProofHandler(this);
59    }
60   
 
61  205 toggle public final void init() {
62  205 proposition = null;
63    }
64   
65    /**
66    * Get proposition.
67    *
68    * @return Proposition.
69    */
 
70  205 toggle public final PropositionVo getProposition() {
71  205 return proposition;
72    }
73   
 
74  509 toggle public final void startElement(final String name, final SimpleAttributes attributes)
75    throws XmlSyntaxException {
76  509 if (getStartTag().equals(name)) {
77  205 proposition = new PropositionVo();
78  304 } else if (formulaHandler.getStartTag().equals(name)) {
79  205 changeHandler(formulaHandler, name, attributes);
80  99 } else if (descriptionHandler.getStartTag().equals(name)) {
81  2 changeHandler(descriptionHandler, name, attributes);
82  97 } else if (proofHandler.getStartTag().equals(name)) {
83  44 changeHandler(proofHandler, name, attributes);
84  53 } else if (formalProofHandler.getStartTag().equals(name)) {
85  53 changeHandler(formalProofHandler, name, attributes);
86    } else {
87  0 throw XmlSyntaxException.createUnexpectedTagException(name);
88    }
89    }
90   
 
91  509 toggle public final void endElement(final String name) throws XmlSyntaxException {
92  509 if (getStartTag().equals(name)) {
93    // nothing to do
94  304 } else if (formulaHandler.getStartTag().equals(name)) {
95  205 proposition.setFormula(formulaHandler.getFormula());
96  99 } else if (descriptionHandler.getStartTag().equals(name)) {
97  2 proposition.setDescription(descriptionHandler.getLatexList());
98  97 } else if (proofHandler.getStartTag().equals(name)) {
99  44 proposition.addProof(proofHandler.getProof());
100  53 } else if (formalProofHandler.getStartTag().equals(name)) {
101  53 proposition.addFormalProof(formalProofHandler.getProof());
102    } else {
103  0 throw XmlSyntaxException.createUnexpectedTagException(name);
104    }
105    }
106   
107    }