Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../../img/srcFileCovDistChart7.png 62% of files have more coverage
18   93   11   3,6
12   44   0,61   5
5     2,2  
1    
 
  AxiomHandler       Line # 33 18 11 65,7% 0.6571429
 
  (41)
 
1    /* $Id: AxiomHandler.java,v 1.1 2008/07/26 08:00:51 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU General Public
9    * License as published by the Free Software Foundation; either
10    * version 2 of the License, or (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    * GNU General Public License for more details.
16    */
17   
18    package org.qedeq.kernel.xml.handler.module;
19   
20    import org.qedeq.kernel.base.module.Axiom;
21    import org.qedeq.kernel.dto.module.AxiomVo;
22    import org.qedeq.kernel.xml.common.XmlSyntaxException;
23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
25   
26   
27    /**
28    * Parse an axiom.
29    *
30    * @version $Revision: 1.1 $
31    * @author Michael Meyling
32    */
 
33    public class AxiomHandler extends AbstractSimpleHandler {
34   
35    /** Handler for axiom formula. */
36    private final FormulaHandler formulaHandler;
37   
38    /** Handler for rule description. */
39    private final LatexListHandler descriptionHandler;
40   
41    /** Axiom value object. */
42    private AxiomVo axiom;
43   
44    /**
45    * Deals with axioms.
46    *
47    * @param handler Parent handler.
48    */
 
49  140 toggle public AxiomHandler(final AbstractSimpleHandler handler) {
50  140 super(handler, "AXIOM");
51  140 formulaHandler = new FormulaHandler(this);
52  140 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
53    }
54   
 
55  213 toggle public final void init() {
56  213 axiom = null;
57    }
58   
59    /**
60    * Get axiom.
61    *
62    * @return Axiom.
63    */
 
64  213 toggle public final Axiom getAxiom() {
65  213 return axiom;
66    }
67   
 
68  426 toggle public final void startElement(final String name, final SimpleAttributes attributes)
69    throws XmlSyntaxException {
70  426 if (getStartTag().equals(name)) {
71  213 axiom = new AxiomVo();
72  213 } else if (formulaHandler.getStartTag().equals(name)) {
73  213 changeHandler(formulaHandler, name, attributes);
74  0 } else if (descriptionHandler.getStartTag().equals(name)) {
75  0 changeHandler(descriptionHandler, name, attributes);
76    } else {
77  0 throw XmlSyntaxException.createUnexpectedTagException(name);
78    }
79    }
80   
 
81  426 toggle public final void endElement(final String name) throws XmlSyntaxException {
82  426 if (getStartTag().equals(name)) {
83    // nothing to do
84  213 } else if (formulaHandler.getStartTag().equals(name)) {
85  213 axiom.setFormula(formulaHandler.getFormula());
86  0 } else if (descriptionHandler.getStartTag().equals(name)) {
87  0 axiom.setDescription(descriptionHandler.getLatexList());
88    } else {
89  0 throw XmlSyntaxException.createUnexpectedTagException(name);
90    }
91    }
92   
93    }