|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| package org.qedeq.kernel.xml.handler.module; |
|
19 |
| |
|
20 |
| import org.qedeq.kernel.dto.module.PropositionVo; |
|
21 |
| import org.qedeq.kernel.xml.parser.AbstractSimpleHandler; |
|
22 |
| import org.qedeq.kernel.xml.parser.SimpleAttributes; |
|
23 |
| import org.qedeq.kernel.xml.parser.SyntaxException; |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| public final class PropositionHandler extends AbstractSimpleHandler { |
|
33 |
| |
|
34 |
| |
|
35 |
| private final FormulaHandler formulaHandler; |
|
36 |
| |
|
37 |
| |
|
38 |
| private final LatexListHandler descriptionHandler; |
|
39 |
| |
|
40 |
| |
|
41 |
| private final ProofHandler proofHandler; |
|
42 |
| |
|
43 |
| |
|
44 |
| private PropositionVo proposition; |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
| |
|
52 |
27
| public PropositionHandler(final AbstractSimpleHandler handler) {
|
|
53 |
27
| super(handler, "THEOREM");
|
|
54 |
27
| formulaHandler = new FormulaHandler(this);
|
|
55 |
27
| descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
|
|
56 |
27
| proofHandler = new ProofHandler(this);
|
|
57 |
| } |
|
58 |
| |
|
59 |
174
| public final void init() {
|
|
60 |
174
| proposition = null;
|
|
61 |
| } |
|
62 |
| |
|
63 |
| |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
174
| public final PropositionVo getProposition() {
|
|
69 |
174
| return proposition;
|
|
70 |
| } |
|
71 |
| |
|
72 |
377
| public final void startElement(final String name, final SimpleAttributes attributes)
|
|
73 |
| throws SyntaxException { |
|
74 |
377
| if (getStartTag().equals(name)) {
|
|
75 |
174
| proposition = new PropositionVo();
|
|
76 |
203
| } else if (formulaHandler.getStartTag().equals(name)) {
|
|
77 |
174
| changeHandler(formulaHandler, name, attributes);
|
|
78 |
29
| } else if (descriptionHandler.getStartTag().equals(name)) {
|
|
79 |
3
| changeHandler(descriptionHandler, name, attributes);
|
|
80 |
26
| } else if (proofHandler.getStartTag().equals(name)) {
|
|
81 |
26
| changeHandler(proofHandler, name, attributes);
|
|
82 |
| } else { |
|
83 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
|
84 |
| } |
|
85 |
| } |
|
86 |
| |
|
87 |
377
| public final void endElement(final String name) throws SyntaxException {
|
|
88 |
377
| if (getStartTag().equals(name)) {
|
|
89 |
| |
|
90 |
203
| } else if (formulaHandler.getStartTag().equals(name)) {
|
|
91 |
174
| proposition.setFormula(formulaHandler.getFormula());
|
|
92 |
29
| } else if (descriptionHandler.getStartTag().equals(name)) {
|
|
93 |
3
| proposition.setDescription(descriptionHandler.getLatexList());
|
|
94 |
26
| } else if (proofHandler.getStartTag().equals(name)) {
|
|
95 |
26
| proposition.addProof(proofHandler.getProof());
|
|
96 |
| } else { |
|
97 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
|
98 |
| } |
|
99 |
| } |
|
100 |
| |
|
101 |
| } |