Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
13   85   9   2,6
8   38   0,69   5
5     1,8  
1    
 
  VariableListHandler       Line # 33 13 9 84,6% 0.84615386
 
  (41)
 
1    /* $Id: VariableListHandler.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.dto.module.VariableListVo;
21    import org.qedeq.kernel.xml.common.XmlSyntaxException;
22    import org.qedeq.kernel.xml.handler.list.ElementHandler;
23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
25   
26   
27    /**
28    * Parse variables.
29    *
30    * @version $Revision: 1.1 $
31    * @author Michael Meyling
32    */
 
33    public class VariableListHandler extends AbstractSimpleHandler {
34   
35    /** Value object: list of variables for formulas and terms. */
36    private VariableListVo variables;
37   
38    /** Handles the element parsing. */
39    private final ElementHandler elementHandler;
40   
41   
42    /**
43    * Handles variables list of definitions.
44    *
45    * @param handler Parent handler.
46    */
 
47  280 toggle public VariableListHandler(final AbstractSimpleHandler handler) {
48  280 super(handler, "VARLIST");
49  280 elementHandler = new ElementHandler(this);
50    }
51   
 
52  300 toggle public final void init() {
53  300 variables = null;
54    }
55   
56    /**
57    * Get parsed result.
58    *
59    * @return List of parsed variables.
60    */
 
61  300 toggle public final VariableListVo getVariables() {
62  300 return variables;
63    }
64   
 
65  801 toggle public final void startElement(final String name, final SimpleAttributes attributes)
66    throws XmlSyntaxException {
67  801 if (getStartTag().equals(name)) {
68  300 variables = new VariableListVo();
69  501 } else if (getLevel() > 1) {
70  501 changeHandler(elementHandler, name, attributes);
71    } else {
72  0 throw XmlSyntaxException.createUnexpectedTagException(name);
73    }
74    }
75   
 
76  801 toggle public final void endElement(final String name) throws XmlSyntaxException {
77  801 if (getStartTag().equals(name)) {
78    // nothing to do
79  501 } else if (getLevel() > 1) {
80  501 variables.add(elementHandler.getElement());
81    } else {
82  0 throw XmlSyntaxException.createUnexpectedTagException(name);
83    }
84    }
85    }