Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart9.png 45% of files have more coverage
20   100   13   4
16   48   0.65   5
5     2.6  
1    
 
  ConditionalProofHandler       Line # 29 20 13 90.2% 0.902439
 
  (6)
 
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.ConditionalProofVo;
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 conditional proof rule usage.
26    *
27    * @author Michael Meyling
28    */
 
29    public class ConditionalProofHandler extends AbstractSimpleHandler {
30   
31    /** Rule value object. */
32    private ConditionalProofVo conditionalProof;
33   
34    /** Handle hypothesis. */
35    private HypothesisHandler hypothesisHandler;
36   
37    /** Handle elements. */
38    private FormalProofLineListHandler proofListHandler;
39   
40    /** Handle hypothesis. */
41    private ConclusionHandler conclusionHandler;
42   
43    /**
44    * Deals with definitions.
45    *
46    * @param handler Parent handler.
47    */
 
48  1064 toggle public ConditionalProofHandler(final AbstractSimpleHandler handler) {
49  1064 super(handler, "CP");
50    }
51   
 
52  450 toggle public final void init() {
53  450 conditionalProof = null;
54    // we initialize the parsers only when really needed (so we have no recursive calls)
55  450 hypothesisHandler = new HypothesisHandler(this);
56  450 proofListHandler = new FormalProofLineListHandler(this);
57  450 conclusionHandler = new ConclusionHandler(this);
58    }
59   
60    /**
61    * Get conditional proof usage.
62    *
63    * @return Substitute Free Variable usage.
64    */
 
65  450 toggle public final ConditionalProofVo getConditionalProofVo() {
66  450 return conditionalProof;
67    }
68   
 
69  1800 toggle public final void startElement(final String name, final SimpleAttributes attributes)
70    throws XmlSyntaxException {
71  1800 if (getStartTag().equals(name)) {
72    // ok
73  1350 } else if (hypothesisHandler.getStartTag().equals(name)) {
74  450 changeHandler(hypothesisHandler, name, attributes);
75  900 } else if (proofListHandler.getStartTag().equals(name)) {
76  450 changeHandler(proofListHandler, name, attributes);
77  450 } else if (conclusionHandler.getStartTag().equals(name)) {
78  450 changeHandler(conclusionHandler, name, attributes);
79    } else {
80  0 throw XmlSyntaxException.createUnexpectedTagException(name);
81    }
82    }
83   
 
84  1800 toggle public final void endElement(final String name) throws XmlSyntaxException {
85  1800 if (getStartTag().equals(name)) {
86  450 conditionalProof = new ConditionalProofVo(hypothesisHandler.getHypothesis(),
87    proofListHandler.getFormalProofLineList(),
88    conclusionHandler.getConclusion());
89  1350 } else if (hypothesisHandler.getStartTag().equals(name)) {
90    // ok
91  900 } else if (proofListHandler.getStartTag().equals(name)) {
92    // ok
93  450 } else if (conclusionHandler.getStartTag().equals(name)) {
94    // ok
95    } else {
96  0 throw XmlSyntaxException.createUnexpectedTagException(name);
97    }
98    }
99   
100    }