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.SectionVo; |
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 |
|
|
27 |
|
@version |
28 |
|
@author |
29 |
|
|
|
|
| 91.1% |
Uncovered Elements: 4 (45) |
Complexity: 13 |
Complexity Density: 0.54 |
|
30 |
|
public class SectionHandler extends AbstractSimpleHandler { |
31 |
|
|
32 |
|
|
33 |
|
public static final String INTRODUCTION_TAG = "INTRODUCTION"; |
34 |
|
|
35 |
|
|
36 |
|
public static final String SECTION_TAG = "SECTION"; |
37 |
|
|
38 |
|
|
39 |
|
public static final String TITLE_TAG = "TITLE"; |
40 |
|
|
41 |
|
|
42 |
|
private final LatexListHandler titleHandler; |
43 |
|
|
44 |
|
|
45 |
|
private final LatexListHandler introductionHandler; |
46 |
|
|
47 |
|
|
48 |
|
private final SubsectionListHandler subsectionListHandler; |
49 |
|
|
50 |
|
|
51 |
|
private SectionVo section; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
@param |
58 |
|
|
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
60 |
147
|
public SectionHandler(final AbstractSimpleHandler handler) {... |
61 |
147
|
super(handler, SECTION_TAG); |
62 |
147
|
titleHandler = new LatexListHandler(this, TITLE_TAG); |
63 |
147
|
introductionHandler = new LatexListHandler(this, INTRODUCTION_TAG); |
64 |
147
|
subsectionListHandler = new SubsectionListHandler(this); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
167
|
public final void init() {... |
68 |
167
|
section = null; |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
@return |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
167
|
public final SectionVo getSection() {... |
77 |
167
|
return section; |
78 |
|
} |
79 |
|
|
|
|
| 88.9% |
Uncovered Elements: 2 (18) |
Complexity: 5 |
Complexity Density: 0.5 |
|
80 |
611
|
public final void startElement(final String name, final SimpleAttributes attributes)... |
81 |
|
throws XmlSyntaxException { |
82 |
611
|
if (getStartTag().equals(name)) { |
83 |
167
|
section = new SectionVo(); |
84 |
167
|
section.setNoNumber(attributes.getBoolean("noNumber")); |
85 |
444
|
} else if (TITLE_TAG.equals(name)) { |
86 |
167
|
changeHandler(titleHandler, name, attributes); |
87 |
277
|
} else if (INTRODUCTION_TAG.equals(name)) { |
88 |
161
|
changeHandler(introductionHandler, name, attributes); |
89 |
116
|
} else if ("SUBSECTIONS".equals(name)) { |
90 |
116
|
changeHandler(subsectionListHandler, name, attributes); |
91 |
|
} else { |
92 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
93 |
|
} |
94 |
|
} |
95 |
|
|
|
|
| 87.5% |
Uncovered Elements: 2 (16) |
Complexity: 5 |
Complexity Density: 0.62 |
|
96 |
611
|
public final void endElement(final String name) throws XmlSyntaxException {... |
97 |
611
|
if (getStartTag().equals(name)) { |
98 |
|
|
99 |
444
|
} else if (TITLE_TAG.equals(name)) { |
100 |
167
|
section.setTitle(titleHandler.getLatexList()); |
101 |
277
|
} else if (INTRODUCTION_TAG.equals(name)) { |
102 |
161
|
section.setIntroduction(introductionHandler.getLatexList()); |
103 |
116
|
} else if ("SUBSECTIONS".equals(name)) { |
104 |
116
|
section.setSubsectionList(subsectionListHandler.getSubsectionList()); |
105 |
|
} else { |
106 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
107 |
|
} |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
|
} |