Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../../../img/srcFileCovDistChart7.png 67% of files have more coverage
18   91   11   3.6
12   44   0.61   5
5     2.2  
1    
 
  AxiomHandler       Line # 31 18 11 65.7% 0.6571429
 
  (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.base.module.Axiom;
19    import org.qedeq.kernel.dto.module.AxiomVo;
20    import org.qedeq.kernel.xml.common.XmlSyntaxException;
21    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
22    import org.qedeq.kernel.xml.parser.SimpleAttributes;
23   
24   
25    /**
26    * Parse an axiom.
27    *
28    * @version $Revision: 1.1 $
29    * @author Michael Meyling
30    */
 
31    public class AxiomHandler extends AbstractSimpleHandler {
32   
33    /** Handler for axiom formula. */
34    private final FormulaHandler formulaHandler;
35   
36    /** Handler for rule description. */
37    private final LatexListHandler descriptionHandler;
38   
39    /** Axiom value object. */
40    private AxiomVo axiom;
41   
42    /**
43    * Deals with axioms.
44    *
45    * @param handler Parent handler.
46    */
 
47  177 toggle public AxiomHandler(final AbstractSimpleHandler handler) {
48  177 super(handler, "AXIOM");
49  177 formulaHandler = new FormulaHandler(this);
50  177 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
51    }
52   
 
53  265 toggle public final void init() {
54  265 axiom = null;
55    }
56   
57    /**
58    * Get axiom.
59    *
60    * @return Axiom.
61    */
 
62  265 toggle public final Axiom getAxiom() {
63  265 return axiom;
64    }
65   
 
66  530 toggle public final void startElement(final String name, final SimpleAttributes attributes)
67    throws XmlSyntaxException {
68  530 if (getStartTag().equals(name)) {
69  265 axiom = new AxiomVo();
70  265 } else if (formulaHandler.getStartTag().equals(name)) {
71  265 changeHandler(formulaHandler, name, attributes);
72  0 } else if (descriptionHandler.getStartTag().equals(name)) {
73  0 changeHandler(descriptionHandler, name, attributes);
74    } else {
75  0 throw XmlSyntaxException.createUnexpectedTagException(name);
76    }
77    }
78   
 
79  530 toggle public final void endElement(final String name) throws XmlSyntaxException {
80  530 if (getStartTag().equals(name)) {
81    // nothing to do
82  265 } else if (formulaHandler.getStartTag().equals(name)) {
83  265 axiom.setFormula(formulaHandler.getFormula());
84  0 } else if (descriptionHandler.getStartTag().equals(name)) {
85  0 axiom.setDescription(descriptionHandler.getLatexList());
86    } else {
87  0 throw XmlSyntaxException.createUnexpectedTagException(name);
88    }
89    }
90   
91    }