Clover Coverage Report
Coverage timestamp: Fri Feb 14 2014 07:28:57 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
39   124   19   7.8
28   68   0.49   5
5     3.8  
1    
 
  HeaderHandler       Line # 30 39 19 94.4% 0.9444444
 
  (80)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2014, 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.HeaderVo;
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    /**
25    * Parse header informations.
26    *
27    * @version $Revision: 1.1 $
28    * @author Michael Meyling
29    */
 
30    public class HeaderHandler extends AbstractSimpleHandler {
31   
32    /** Value object for module header. */
33    private HeaderVo header;
34   
35    /** Handler for module specification. */
36    private final SpecificationHandler specificationHandler;
37   
38    /** Handler for module title. */
39    private final LatexListHandler titleHandler;
40   
41    /** Handler for module abstract. */
42    private final LatexListHandler abstractHandler;
43   
44    /** Handler for list of module authors. */
45    private final AuthorListHandler authorListHandler;
46   
47    /** Handler for list of module imports. */
48    private final ImportListHandler importListHandler;
49   
50    /** Handler for list of modules that need this one. */
51    private final UsedByListHandler usedbyListHandler;
52   
53   
54    /**
55    * Deals with header of qedeq file.
56    *
57    * @param handler Parent handler.
58    */
 
59  680 toggle public HeaderHandler(final AbstractSimpleHandler handler) {
60  680 super(handler, "HEADER");
61  680 titleHandler = new LatexListHandler(this, "TITLE");
62  680 abstractHandler = new LatexListHandler(this, "ABSTRACT");
63  680 specificationHandler = new SpecificationHandler(this);
64  680 authorListHandler = new AuthorListHandler(this);
65  680 importListHandler = new ImportListHandler(this);
66  680 usedbyListHandler = new UsedByListHandler(this);
67    }
68   
 
69  661 toggle public final void init() {
70  661 header = null;
71    }
72   
73    /**
74    * Get header of qedeq module.
75    *
76    * @return Header of qedeq module.
77    */
 
78  661 toggle public final HeaderVo getHeader() {
79  661 return header;
80    }
81   
 
82  3871 toggle public final void startElement(final String name, final SimpleAttributes attributes)
83    throws XmlSyntaxException {
84  3871 if (getStartTag().equals(name)) {
85  661 header = new HeaderVo();
86  661 header.setEmail(attributes.getString("email"));
87  3210 } else if (specificationHandler.getStartTag().equals(name)) {
88  661 changeHandler(specificationHandler, name, attributes);
89  2549 } else if (titleHandler.getStartTag().equals(name)) {
90  661 changeHandler(titleHandler, name, attributes);
91  1888 } else if (abstractHandler.getStartTag().equals(name)) {
92  661 changeHandler(abstractHandler, name, attributes);
93  1227 } else if (authorListHandler.getStartTag().equals(name)) {
94  661 changeHandler(authorListHandler, name, attributes);
95  566 } else if (importListHandler.getStartTag().equals(name)) {
96  409 changeHandler(importListHandler, name, attributes);
97  157 } else if (usedbyListHandler.getStartTag().equals(name)) {
98  157 changeHandler(usedbyListHandler, name, attributes);
99    } else {
100  0 throw XmlSyntaxException.createUnexpectedTagException(name);
101    }
102    }
103   
 
104  3871 toggle public final void endElement(final String name) throws XmlSyntaxException {
105  3871 if (getStartTag().equals(name)) {
106    // nothing to do
107  3210 } else if (specificationHandler.getStartTag().equals(name)) {
108  661 header.setSpecification(specificationHandler.getSpecification());
109  2549 } else if (titleHandler.getStartTag().equals(name)) {
110  661 header.setTitle(titleHandler.getLatexList());
111  1888 } else if (abstractHandler.getStartTag().equals(name)) {
112  661 header.setSummary(abstractHandler.getLatexList());
113  1227 } else if (authorListHandler.getStartTag().equals(name)) {
114  661 header.setAuthorList(authorListHandler.getAuthorList());
115  566 } else if (importListHandler.getStartTag().equals(name)) {
116  409 header.setImportList(importListHandler.getImportList());
117  157 } else if (usedbyListHandler.getStartTag().equals(name)) {
118  157 header.setUsedByList(usedbyListHandler.getUsedByList());
119    } else {
120  0 throw XmlSyntaxException.createUnexpectedTagException(name);
121    }
122    }
123   
124    }