Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart9.png 45% of files have more coverage
17   89   11   3.4
12   42   0.65   5
5     2.2  
1    
 
  SubsectionListHandler       Line # 29 17 11 88.2% 0.88235295
 
  (102)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, 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.se.dto.module.SubsectionListVo;
19    import org.qedeq.kernel.xml.common.XmlSyntaxException;
20    import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
21    import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
22   
23    /**
24    * Parse subsection list.
25    *
26    * @version $Revision: 1.1 $
27    * @author Michael Meyling
28    */
 
29    public class SubsectionListHandler extends AbstractSimpleHandler {
30   
31    /** List of subsections. */
32    private SubsectionListVo list;
33   
34    /** Parses an subsection. */
35    private final SubsectionHandler subsectionHandler;
36   
37    /** Handle single node of a section. */
38    private final NodeHandler nodeHandler;
39   
40   
41    /**
42    * Handles list of subsections.
43    *
44    * @param handler Parent handler.
45    */
 
46  614 toggle public SubsectionListHandler(final AbstractSimpleHandler handler) {
47  614 super(handler, "SUBSECTIONS");
48  614 subsectionHandler = new SubsectionHandler(this);
49  614 nodeHandler = new NodeHandler(this);
50    }
51   
 
52  3150 toggle public final void init() {
53  3150 list = new SubsectionListVo();
54    }
55   
56    /**
57    * Get list of subsections.
58    *
59    * @return Subsection list.
60    */
 
61  3150 toggle public final SubsectionListVo getSubsectionList() {
62  3150 return list;
63    }
64   
 
65  23356 toggle public final void startElement(final String name, final SimpleAttributes attributes)
66    throws XmlSyntaxException {
67  23356 if (getStartTag().equals(name)) {
68    // nothing to do
69  20206 } else if (subsectionHandler.getStartTag().equals(name)) {
70  1106 changeHandler(subsectionHandler, name, attributes);
71  19100 } else if (nodeHandler.getStartTag().equals(name)) {
72  19100 changeHandler(nodeHandler, name, attributes);
73    } else {
74  0 throw XmlSyntaxException.createUnexpectedTagException(name);
75    }
76    }
77   
 
78  23356 toggle public final void endElement(final String name) throws XmlSyntaxException {
79  23356 if (getStartTag().equals(name)) {
80    // nothing to do
81  20206 } else if (subsectionHandler.getStartTag().equals(name)) {
82  1106 list.add(subsectionHandler.getSubsection());
83  19100 } else if (nodeHandler.getStartTag().equals(name)) {
84  19100 list.add(nodeHandler.getNode());
85    } else {
86  0 throw XmlSyntaxException.createUnexpectedTagException(name);
87    }
88    }
89    }