Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../../../img/srcFileCovDistChart9.png 34% of files have more coverage
13   83   9   2.6
8   38   0.69   5
5     1.8  
1    
 
  VariableListHandler       Line # 31 13 9 84.6% 0.84615386
 
  (55)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2010, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.xml.handler.module;
17   
18    import org.qedeq.kernel.dto.module.VariableListVo;
19    import org.qedeq.kernel.xml.common.XmlSyntaxException;
20    import org.qedeq.kernel.xml.handler.list.ElementHandler;
21    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
22    import org.qedeq.kernel.xml.parser.SimpleAttributes;
23   
24   
25    /**
26    * Parse variables.
27    *
28    * @version $Revision: 1.1 $
29    * @author Michael Meyling
30    */
 
31    public class VariableListHandler extends AbstractSimpleHandler {
32   
33    /** Value object: list of variables for formulas and terms. */
34    private VariableListVo variables;
35   
36    /** Handles the element parsing. */
37    private final ElementHandler elementHandler;
38   
39   
40    /**
41    * Handles variables list of definitions.
42    *
43    * @param handler Parent handler.
44    */
 
45  354 toggle public VariableListHandler(final AbstractSimpleHandler handler) {
46  354 super(handler, "VARLIST");
47  354 elementHandler = new ElementHandler(this);
48    }
49   
 
50  354 toggle public final void init() {
51  354 variables = null;
52    }
53   
54    /**
55    * Get parsed result.
56    *
57    * @return List of parsed variables.
58    */
 
59  354 toggle public final VariableListVo getVariables() {
60  354 return variables;
61    }
62   
 
63  958 toggle public final void startElement(final String name, final SimpleAttributes attributes)
64    throws XmlSyntaxException {
65  958 if (getStartTag().equals(name)) {
66  354 variables = new VariableListVo();
67  604 } else if (getLevel() > 1) {
68  604 changeHandler(elementHandler, name, attributes);
69    } else {
70  0 throw XmlSyntaxException.createUnexpectedTagException(name);
71    }
72    }
73   
 
74  958 toggle public final void endElement(final String name) throws XmlSyntaxException {
75  958 if (getStartTag().equals(name)) {
76    // nothing to do
77  604 } else if (getLevel() > 1) {
78  604 variables.add(elementHandler.getElement());
79    } else {
80  0 throw XmlSyntaxException.createUnexpectedTagException(name);
81    }
82    }
83    }