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.base.module.InitialPredicateDefinition; |
19 |
|
import org.qedeq.kernel.se.dto.module.InitialPredicateDefinitionVo; |
20 |
|
import org.qedeq.kernel.xml.common.XmlSyntaxException; |
21 |
|
import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler; |
22 |
|
import org.qedeq.kernel.xml.handler.common.SimpleAttributes; |
23 |
|
import org.qedeq.kernel.xml.handler.list.ElementHandler; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
@author |
30 |
|
|
|
|
| 72.5% |
Uncovered Elements: 14 (51) |
Complexity: 15 |
Complexity Density: 0.56 |
|
31 |
|
public class InitialPredicateDefinitionHandler extends AbstractSimpleHandler { |
32 |
|
|
33 |
|
|
34 |
|
private final ElementHandler elementHandler; |
35 |
|
|
36 |
|
|
37 |
|
private final LatexListHandler descriptionHandler; |
38 |
|
|
39 |
|
|
40 |
|
private InitialPredicateDefinitionVo definition; |
41 |
|
|
42 |
|
|
43 |
|
private String latexPattern; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
@param |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
51 |
614
|
public InitialPredicateDefinitionHandler(final AbstractSimpleHandler handler) {... |
52 |
614
|
super(handler, "DEFINITION_PREDICATE_INITIAL"); |
53 |
614
|
elementHandler = new ElementHandler(this); |
54 |
614
|
descriptionHandler = new LatexListHandler(this, "DESCRIPTION"); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
57 |
370
|
public final void init() {... |
58 |
370
|
definition = null; |
59 |
370
|
latexPattern = null; |
60 |
|
} |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
@return |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
370
|
public final InitialPredicateDefinition getInitialDefinition() {... |
68 |
370
|
return definition; |
69 |
|
} |
70 |
|
|
|
|
| 66.7% |
Uncovered Elements: 6 (18) |
Complexity: 5 |
Complexity Density: 0.5 |
|
71 |
1110
|
public final void startElement(final String name, final SimpleAttributes attributes)... |
72 |
|
throws XmlSyntaxException { |
73 |
1110
|
if (getStartTag().equals(name)) { |
74 |
370
|
definition = new InitialPredicateDefinitionVo(); |
75 |
370
|
definition.setArgumentNumber(attributes.getString("arguments")); |
76 |
370
|
definition.setName(attributes.getString("name")); |
77 |
740
|
} else if ("LATEXPATTERN".equals(name)) { |
78 |
|
|
79 |
370
|
} else if ("PREDCON".equals(name)) { |
80 |
370
|
changeHandler(elementHandler, name, attributes); |
81 |
0
|
} else if (descriptionHandler.getStartTag().equals(name)) { |
82 |
0
|
changeHandler(descriptionHandler, name, attributes); |
83 |
|
} else { |
84 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
85 |
|
} |
86 |
|
} |
87 |
|
|
|
|
| 62.5% |
Uncovered Elements: 6 (16) |
Complexity: 5 |
Complexity Density: 0.62 |
|
88 |
1110
|
public final void endElement(final String name) throws XmlSyntaxException {... |
89 |
1110
|
if (getStartTag().equals(name)) { |
90 |
|
|
91 |
740
|
} else if ("LATEXPATTERN".equals(name)) { |
92 |
370
|
definition.setLatexPattern(latexPattern); |
93 |
370
|
} else if ("PREDCON".equals(name)) { |
94 |
370
|
definition.setPredCon(elementHandler.getElement()); |
95 |
0
|
} else if (descriptionHandler.getStartTag().equals(name)) { |
96 |
0
|
definition.setDescription(descriptionHandler.getLatexList()); |
97 |
|
} else { |
98 |
0
|
throw XmlSyntaxException.createUnexpectedTagException(name); |
99 |
|
} |
100 |
|
} |
101 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
102 |
370
|
public final void characters(final String name, final String data) {... |
103 |
370
|
if ("LATEXPATTERN".equals(name)) { |
104 |
370
|
latexPattern = data; |
105 |
|
} else { |
106 |
0
|
throw new RuntimeException("Unexpected character data in tag: " + name); |
107 |
|
} |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
|
} |