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