Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 86   Methods: 5
NCLOC: 39   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
VariableListHandler.java 75% 84,6% 100% 84,6%
coverage coverage
 1    /* $Id: VariableListHandler.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.VariableList;
 21    import org.qedeq.kernel.dto.module.VariableListVo;
 22    import org.qedeq.kernel.xml.handler.elli.ElementHandler;
 23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
 24    import org.qedeq.kernel.xml.parser.SyntaxException;
 25    import org.qedeq.kernel.xml.parser.SimpleAttributes;
 26   
 27   
 28    /**
 29    * Parse variables.
 30    *
 31    * @version $Revision: 1.10 $
 32    * @author Michael Meyling
 33    */
 34    public final class VariableListHandler extends AbstractSimpleHandler {
 35   
 36    /** Value object: list of variables for formulas and terms. */
 37    private VariableListVo variables;
 38   
 39    /** Handles the element parsing. */
 40    private final ElementHandler elementHandler;
 41   
 42   
 43    /**
 44    * Handles variables list of definitions.
 45    *
 46    * @param handler Parent handler.
 47    */
 48  50 public VariableListHandler(final AbstractSimpleHandler handler) {
 49  50 super(handler, "VARLIST");
 50  50 elementHandler = new ElementHandler(this);
 51    }
 52   
 53  99 public final void init() {
 54  99 variables = null;
 55    }
 56   
 57    /**
 58    * Get parsed result.
 59    *
 60    * @return List of parsed variables.
 61    */
 62  99 public final VariableList getVariables() {
 63  99 return variables;
 64    }
 65   
 66  246 public final void startElement(final String name, final SimpleAttributes attributes)
 67    throws SyntaxException {
 68  246 if (getStartTag().equals(name)) {
 69  99 variables = new VariableListVo();
 70  147 } else if (getLevel() > 1) {
 71  147 changeHandler(elementHandler, name, attributes);
 72    } else {
 73  0 throw SyntaxException.createUnexpectedTagException(name);
 74    }
 75    }
 76   
 77  246 public final void endElement(final String name) throws SyntaxException {
 78  246 if (getStartTag().equals(name)) {
 79    // nothing to do
 80  147 } else if (getLevel() > 1) {
 81  147 variables.add(elementHandler.getElement());
 82    } else {
 83  0 throw SyntaxException.createUnexpectedTagException(name);
 84    }
 85    }
 86    }