Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart7.png 74% of files have more coverage
19   92   11   3.8
12   45   0.58   5
5     2.2  
1    
 
  AxiomHandler       Line # 31 19 11 66.7% 0.6666667
 
  (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.base.module.Axiom;
19    import org.qedeq.kernel.se.dto.module.AxiomVo;
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 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  614 toggle public AxiomHandler(final AbstractSimpleHandler handler) {
48  614 super(handler, "AXIOM");
49  614 formulaHandler = new FormulaHandler(this);
50  614 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
51    }
52   
 
53  3465 toggle public final void init() {
54  3465 axiom = null;
55    }
56   
57    /**
58    * Get axiom.
59    *
60    * @return Axiom.
61    */
 
62  3465 toggle public final Axiom getAxiom() {
63  3465 return axiom;
64    }
65   
 
66  6930 toggle public final void startElement(final String name, final SimpleAttributes attributes)
67    throws XmlSyntaxException {
68  6930 if (getStartTag().equals(name)) {
69  3465 axiom = new AxiomVo();
70  3465 axiom.setDefinedOperator(attributes.getString("definedOperator"));
71  3465 } else if (formulaHandler.getStartTag().equals(name)) {
72  3465 changeHandler(formulaHandler, name, attributes);
73  0 } else if (descriptionHandler.getStartTag().equals(name)) {
74  0 changeHandler(descriptionHandler, name, attributes);
75    } else {
76  0 throw XmlSyntaxException.createUnexpectedTagException(name);
77    }
78    }
79   
 
80  6930 toggle public final void endElement(final String name) throws XmlSyntaxException {
81  6930 if (getStartTag().equals(name)) {
82    // nothing to do
83  3465 } else if (formulaHandler.getStartTag().equals(name)) {
84  3465 axiom.setFormula(formulaHandler.getFormula());
85  0 } else if (descriptionHandler.getStartTag().equals(name)) {
86  0 axiom.setDescription(descriptionHandler.getLatexList());
87    } else {
88  0 throw XmlSyntaxException.createUnexpectedTagException(name);
89    }
90    }
91   
92    }