Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 93   Methods: 5
NCLOC: 44   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AxiomHandler.java 50% 66,7% 100% 65,7%
coverage coverage
 1    /* $Id: AxiomHandler.java,v 1.14 2007/05/10 00:37:50 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, 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.common.SyntaxException;
 22    import org.qedeq.kernel.dto.module.AxiomVo;
 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.14 $
 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  46 public AxiomHandler(final AbstractSimpleHandler handler) {
 50  46 super(handler, "AXIOM");
 51  46 formulaHandler = new FormulaHandler(this);
 52  46 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
 53    }
 54   
 55  119 public final void init() {
 56  119 axiom = null;
 57    }
 58   
 59    /**
 60    * Get axiom.
 61    *
 62    * @return Axiom.
 63    */
 64  119 public final Axiom getAxiom() {
 65  119 return axiom;
 66    }
 67   
 68  238 public final void startElement(final String name, final SimpleAttributes attributes)
 69    throws SyntaxException {
 70  238 if (getStartTag().equals(name)) {
 71  119 axiom = new AxiomVo();
 72  119 } else if (formulaHandler.getStartTag().equals(name)) {
 73  119 changeHandler(formulaHandler, name, attributes);
 74  0 } else if (descriptionHandler.getStartTag().equals(name)) {
 75  0 changeHandler(descriptionHandler, name, attributes);
 76    } else {
 77  0 throw SyntaxException.createUnexpectedTagException(name);
 78    }
 79    }
 80   
 81  238 public final void endElement(final String name) throws SyntaxException {
 82  238 if (getStartTag().equals(name)) {
 83    // nothing to do
 84  119 } else if (formulaHandler.getStartTag().equals(name)) {
 85  119 axiom.setFormula(formulaHandler.getFormula());
 86  0 } else if (descriptionHandler.getStartTag().equals(name)) {
 87  0 axiom.setDescription(descriptionHandler.getLatexList());
 88    } else {
 89  0 throw SyntaxException.createUnexpectedTagException(name);
 90    }
 91    }
 92   
 93    }