Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
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.10 2006/10/20 20:23:02 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.parser.AbstractSimpleHandler;
 23    import org.qedeq.kernel.xml.parser.SyntaxException;
 24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 25   
 26   
 27    /**
 28    * Parse an axiom.
 29    *
 30    * @version $Revision: 1.10 $
 31    * @author Michael Meyling
 32    */
 33    public final 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  27 public AxiomHandler(final AbstractSimpleHandler handler) {
 50  27 super(handler, "AXIOM");
 51  27 formulaHandler = new FormulaHandler(this);
 52  27 descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
 53    }
 54   
 55  60 public final void init() {
 56  60 axiom = null;
 57    }
 58   
 59    /**
 60    * Get axiom.
 61    *
 62    * @return Axiom.
 63    */
 64  60 public final Axiom getAxiom() {
 65  60 return axiom;
 66    }
 67   
 68  120 public final void startElement(final String name, final SimpleAttributes attributes)
 69    throws SyntaxException {
 70  120 if (getStartTag().equals(name)) {
 71  60 axiom = new AxiomVo();
 72  60 } else if (formulaHandler.getStartTag().equals(name)) {
 73  60 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  120 public final void endElement(final String name) throws SyntaxException {
 82  120 if (getStartTag().equals(name)) {
 83    // nothing to do
 84  60 } else if (formulaHandler.getStartTag().equals(name)) {
 85  60 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    }