Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart9.png 45% of files have more coverage
14   83   9   2.8
8   39   0.64   5
5     1.8  
1    
 
  HypothesisHandler       Line # 30 14 9 85.2% 0.8518519
 
  (5)
 
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.base.module.Hypothesis;
19    import org.qedeq.kernel.se.dto.module.HypothesisVo;
20    import org.qedeq.kernel.xml.common.XmlSyntaxException;
21    import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
22    import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
23   
24   
25    /**
26    * Parse a hypothesis.
27    *
28    * @author Michael Meyling
29    */
 
30    public class HypothesisHandler extends AbstractSimpleHandler {
31   
32    /** Handler for axiom formula. */
33    private final FormulaHandler formulaHandler;
34   
35    /** Hypothesis value object. */
36    private HypothesisVo hypothesis;
37   
38    /**
39    * Deals with axioms.
40    *
41    * @param handler Parent handler.
42    */
 
43  450 toggle public HypothesisHandler(final AbstractSimpleHandler handler) {
44  450 super(handler, "HYPOTHESIS");
45  450 formulaHandler = new FormulaHandler(this);
46    }
47   
 
48  450 toggle public final void init() {
49  450 hypothesis = null;
50    }
51   
52    /**
53    * Get hypothesis.
54    *
55    * @return Hypothesis.
56    */
 
57  450 toggle public final Hypothesis getHypothesis() {
58  450 return hypothesis;
59    }
60   
 
61  900 toggle public final void startElement(final String name, final SimpleAttributes attributes)
62    throws XmlSyntaxException {
63  900 if (getStartTag().equals(name)) {
64  450 hypothesis = new HypothesisVo();
65  450 hypothesis.setLabel(attributes.getString("label"));
66  450 } else if (formulaHandler.getStartTag().equals(name)) {
67  450 changeHandler(formulaHandler, name, attributes);
68    } else {
69  0 throw XmlSyntaxException.createUnexpectedTagException(name);
70    }
71    }
72   
 
73  900 toggle public final void endElement(final String name) throws XmlSyntaxException {
74  900 if (getStartTag().equals(name)) {
75    // nothing to do
76  450 } else if (formulaHandler.getStartTag().equals(name)) {
77  450 hypothesis.setFormula(formulaHandler.getFormula());
78    } else {
79  0 throw XmlSyntaxException.createUnexpectedTagException(name);
80    }
81    }
82   
83    }