|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| package org.qedeq.kernel.bo.control; |
|
19 |
| |
|
20 |
| import org.qedeq.kernel.base.module.FunctionDefinition; |
|
21 |
| import org.qedeq.kernel.base.module.Import; |
|
22 |
| import org.qedeq.kernel.base.module.Node; |
|
23 |
| import org.qedeq.kernel.base.module.PredicateDefinition; |
|
24 |
| import org.qedeq.kernel.common.DefaultSourceFileExceptionList; |
|
25 |
| import org.qedeq.kernel.common.ModuleContext; |
|
26 |
| import org.qedeq.kernel.common.ModuleDataException; |
|
27 |
| import org.qedeq.kernel.common.ModuleLabels; |
|
28 |
| import org.qedeq.kernel.dto.module.NodeVo; |
|
29 |
| import org.qedeq.kernel.trace.Trace; |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| public final class ModuleLabelsCreator extends ControlVisitor { |
|
39 |
| |
|
40 |
| |
|
41 |
| private static final Class CLASS = ModuleLabelsCreator.class; |
|
42 |
| |
|
43 |
| |
|
44 |
| private ModuleLabels labels; |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
| |
|
51 |
149
| public ModuleLabelsCreator(final KernelQedeqBo prop) {
|
|
52 |
149
| super(prop);
|
|
53 |
| } |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
141
| public void visitEnter(final Import imp) {
|
|
61 |
141
| try {
|
|
62 |
141
| this.labels.addLabel(new ModuleContext(getCurrentContext()),
|
|
63 |
| imp.getLabel()); |
|
64 |
141
| Trace.param(CLASS, "visitEnter(Import)", "adding context", getCurrentContext());
|
|
65 |
| } catch (ModuleDataException me) { |
|
66 |
0
| addModuleDataException(me);
|
|
67 |
0
| Trace.trace(CLASS, this, "visitEnter(Import)", me);
|
|
68 |
| } |
|
69 |
| } |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
0
| public void visitEnter(final FunctionDefinition funcDef) {
|
|
77 |
0
| try {
|
|
78 |
0
| this.labels.checkLabel(new ModuleContext(getCurrentContext()),
|
|
79 |
| funcDef.getName()); |
|
80 |
0
| Trace.param(CLASS, "visitEnter(FunctionDefinition)", "adding context",
|
|
81 |
| getCurrentContext()); |
|
82 |
| } catch (ModuleDataException me) { |
|
83 |
0
| addModuleDataException(me);
|
|
84 |
0
| Trace.trace(CLASS, this, "visitEnter(FunctionDefinition)", me);
|
|
85 |
| } |
|
86 |
| } |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
| |
|
93 |
0
| public void visitEnter(final PredicateDefinition predDef) {
|
|
94 |
0
| try {
|
|
95 |
0
| this.labels.checkLabel(new ModuleContext(getCurrentContext()),
|
|
96 |
| predDef.getName()); |
|
97 |
0
| Trace.param(CLASS, "visitEnter(PredicateDefinition)", "adding context",
|
|
98 |
| getCurrentContext()); |
|
99 |
| } catch (ModuleDataException me) { |
|
100 |
0
| addModuleDataException(me);
|
|
101 |
0
| Trace.trace(CLASS, this, "visitEnter(PredicateDefinition)", me);
|
|
102 |
| } |
|
103 |
| } |
|
104 |
| |
|
105 |
| |
|
106 |
| |
|
107 |
| |
|
108 |
| |
|
109 |
| |
|
110 |
| |
|
111 |
149
| public ModuleLabels createLabels() throws DefaultSourceFileExceptionList {
|
|
112 |
149
| if (this.labels == null) {
|
|
113 |
149
| this.labels = new ModuleLabels();
|
|
114 |
149
| traverse();
|
|
115 |
| } |
|
116 |
143
| return this.labels;
|
|
117 |
| } |
|
118 |
| |
|
119 |
1358
| public void visitEnter(final Node node) throws ModuleDataException {
|
|
120 |
1358
| try {
|
|
121 |
1358
| this.labels.addNode(getCurrentContext(), (NodeVo) node);
|
|
122 |
| } catch (ModuleDataException me) { |
|
123 |
6
| addModuleDataException(me);
|
|
124 |
6
| Trace.trace(CLASS, this, "visitEnter(Node)", me);
|
|
125 |
| } |
|
126 |
1358
| setBlocked(true);
|
|
127 |
| } |
|
128 |
| |
|
129 |
1358
| public void visitLeave(final Node node) {
|
|
130 |
1358
| setBlocked(false);
|
|
131 |
| } |
|
132 |
| |
|
133 |
| } |