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.common.SyntaxException; |
21 |
| import org.qedeq.kernel.dto.module.PropositionVo; |
22 |
| import org.qedeq.kernel.xml.parser.AbstractSimpleHandler; |
23 |
| import org.qedeq.kernel.xml.parser.SimpleAttributes; |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| public 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 |
46
| public PropositionHandler(final AbstractSimpleHandler handler) {
|
53 |
46
| super(handler, "THEOREM");
|
54 |
46
| formulaHandler = new FormulaHandler(this);
|
55 |
46
| descriptionHandler = new LatexListHandler(this, "DESCRIPTION");
|
56 |
46
| proofHandler = new ProofHandler(this);
|
57 |
| } |
58 |
| |
59 |
395
| public final void init() {
|
60 |
395
| proposition = null;
|
61 |
| } |
62 |
| |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
395
| public final PropositionVo getProposition() {
|
69 |
395
| return proposition;
|
70 |
| } |
71 |
| |
72 |
845
| public final void startElement(final String name, final SimpleAttributes attributes)
|
73 |
| throws SyntaxException { |
74 |
845
| if (getStartTag().equals(name)) {
|
75 |
395
| proposition = new PropositionVo();
|
76 |
450
| } else if (formulaHandler.getStartTag().equals(name)) {
|
77 |
395
| changeHandler(formulaHandler, name, attributes);
|
78 |
55
| } else if (descriptionHandler.getStartTag().equals(name)) {
|
79 |
7
| changeHandler(descriptionHandler, name, attributes);
|
80 |
48
| } else if (proofHandler.getStartTag().equals(name)) {
|
81 |
48
| changeHandler(proofHandler, name, attributes);
|
82 |
| } else { |
83 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
84 |
| } |
85 |
| } |
86 |
| |
87 |
845
| public final void endElement(final String name) throws SyntaxException {
|
88 |
845
| if (getStartTag().equals(name)) {
|
89 |
| |
90 |
450
| } else if (formulaHandler.getStartTag().equals(name)) {
|
91 |
395
| proposition.setFormula(formulaHandler.getFormula());
|
92 |
55
| } else if (descriptionHandler.getStartTag().equals(name)) {
|
93 |
7
| proposition.setDescription(descriptionHandler.getLatexList());
|
94 |
48
| } else if (proofHandler.getStartTag().equals(name)) {
|
95 |
48
| proposition.addProof(proofHandler.getProof());
|
96 |
| } else { |
97 |
0
| throw SyntaxException.createUnexpectedTagException(name);
|
98 |
| } |
99 |
| } |
100 |
| |
101 |
| } |