Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
16   92   11   3,2
12   42   0,69   5
5     2,2  
1    
 
  ImportListHandler       Line # 33 16 11 87,9% 0.8787879
 
  (41)
 
1    /* $Id: ImportListHandler.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.ImportListVo;
21    import org.qedeq.kernel.dto.module.ImportVo;
22    import org.qedeq.kernel.xml.common.XmlSyntaxException;
23    import org.qedeq.kernel.xml.parser.AbstractSimpleHandler;
24    import org.qedeq.kernel.xml.parser.SimpleAttributes;
25   
26   
27    /**
28    * Parse author list.
29    *
30    * @version $Revision: 1.1 $
31    * @author Michael Meyling
32    */
 
33    public class ImportListHandler extends AbstractSimpleHandler {
34   
35    /** Value object with list of all module imports. */
36    private ImportListVo list;
37   
38    /** Handler for a single module specification. */
39    private final SpecificationHandler specificationHandler;
40   
41    /** Label for a single module. */
42    private String label;
43   
44   
45    /**
46    * Handles list of imports.
47    *
48    * @param handler Parent handler.
49    */
 
50  140 toggle public ImportListHandler(final AbstractSimpleHandler handler) {
51  140 super(handler, "IMPORTS");
52  140 specificationHandler = new SpecificationHandler(this);
53    }
54   
 
55  92 toggle public final void init() {
56  92 list = null;
57    }
58   
59    /**
60    * Get parsed result.
61    *
62    * @return Location list.
63    */
 
64  92 toggle public final ImportListVo getImportList() {
65  92 return list;
66    }
67   
 
68  370 toggle public final void startElement(final String name, final SimpleAttributes attributes)
69    throws XmlSyntaxException {
70  370 if (getStartTag().equals(name)) {
71  92 list = new ImportListVo();
72  278 } else if ("IMPORT".equals(name)) {
73  139 label = attributes.getString("label");
74  139 } else if (specificationHandler.getStartTag().equals(name)) {
75  139 changeHandler(specificationHandler, name, attributes);
76    } else {
77  0 throw XmlSyntaxException.createUnexpectedTagException(name);
78    }
79    }
80   
 
81  370 toggle public final void endElement(final String name) throws XmlSyntaxException {
82  370 if (getStartTag().equals(name)) {
83    // nothing to do
84  278 } else if (specificationHandler.getStartTag().equals(name)) {
85    // nothing to do
86  139 } else if ("IMPORT".equals(name)) {
87  139 list.add(new ImportVo(label, specificationHandler.getSpecification()));
88    } else {
89  0 throw XmlSyntaxException.createUnexpectedTagException(name);
90    }
91    }
92    }