1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.xml.handler.module; |
17 |
|
|
18 |
|
import org.qedeq.kernel.se.dto.module.ChapterVo; |
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 |
|
|
26 |
|
@author |
27 |
|
|
|
|
| 91.1% |
Uncovered Elements: 4 (45) |
Complexity: 13 |
Complexity Density: 0.54 |
|
28 |
|
public class ChapterHandler extends AbstractSimpleHandler { |
29 |
|
|
30 |
|
|
31 |
|
private final LatexListHandler titleHandler; |
32 |
|
|
33 |
|
|
34 |
|
private final LatexListHandler introductionHandler; |
35 |
|
|
36 |
|
|
37 |
|
private final SectionHandler sectionHandler; |
38 |
|
|
39 |
|
|
40 |
|
private ChapterVo chapter; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
@param |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
47 |
147
|
public ChapterHandler(final AbstractSimpleHandler handler) {... |
48 |
147
|
super(handler, "CHAPTER"); |
49 |
147
|
titleHandler = new LatexListHandler(this, "TITLE"); |
50 |
147
|
introductionHandler = new LatexListHandler(this, "INTRODUCTION"); |
51 |
147
|
sectionHandler = new SectionHandler(this); |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
177
|
public void init() {... |
55 |
177
|
chapter = null; |
56 |
|
} |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
@return |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
177
|
public final ChapterVo getChapter() {... |
64 |
177
|
return chapter; |
65 |
|
} |
66 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 5 |
Complexity Density: 0.5 |
|
67 |
627
|
public final void startElement(final String name, final SimpleAttributes attributes)... |
68 |
|
throws XmlSyntaxException { |
69 |
627
|
if (getStartTag().equals(name)) { |
70 |
177
|
chapter = new ChapterVo(); |
71 |
177
|
chapter.setNoNumber(attributes.getBoolean("noNumber")); |
72 |
450
|
} else if (titleHandler.getStartTag().equals(name)) { |
73 |
177
|
changeHandler(titleHandler, name, attributes); |
74 |
273
|
} else if (introductionHandler.getStartTag().equals(name)) { |
75 |
106
|
changeHandler(introductionHandler, name, attributes); |
76 |
167
|
} else if (sectionHandler.getStartTag().equals(name)) { |
77 |
167
|
changeHandler(sectionHandler, name, attributes); |
78 |
|
} else { |
79 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
80 |
|
} |
81 |
|
} |
82 |
|
|
|
|
| 87.5% |
Uncovered Elements: 2 (16) |
Complexity: 5 |
Complexity Density: 0.62 |
|
83 |
627
|
public final void endElement(final String name) throws XmlSyntaxException {... |
84 |
627
|
if (getStartTag().equals(name)) { |
85 |
|
|
86 |
450
|
} else if (titleHandler.getStartTag().equals(name)) { |
87 |
177
|
chapter.setTitle(titleHandler.getLatexList()); |
88 |
273
|
} else if (introductionHandler.getStartTag().equals(name)) { |
89 |
106
|
chapter.setIntroduction(introductionHandler.getLatexList()); |
90 |
167
|
} else if (sectionHandler.getStartTag().equals(name)) { |
91 |
167
|
chapter.addSection(sectionHandler.getSection()); |
92 |
|
} else { |
93 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
94 |
|
} |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
} |