|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| package org.qedeq.kernel.bo.visitor; |
|
19 |
| |
|
20 |
| import org.qedeq.kernel.base.list.Atom; |
|
21 |
| import org.qedeq.kernel.base.list.Element; |
|
22 |
| import org.qedeq.kernel.base.list.ElementList; |
|
23 |
| import org.qedeq.kernel.base.module.Author; |
|
24 |
| import org.qedeq.kernel.base.module.AuthorList; |
|
25 |
| import org.qedeq.kernel.base.module.Axiom; |
|
26 |
| import org.qedeq.kernel.base.module.Chapter; |
|
27 |
| import org.qedeq.kernel.base.module.ChapterList; |
|
28 |
| import org.qedeq.kernel.base.module.Formula; |
|
29 |
| import org.qedeq.kernel.base.module.FunctionDefinition; |
|
30 |
| import org.qedeq.kernel.base.module.Header; |
|
31 |
| import org.qedeq.kernel.base.module.Import; |
|
32 |
| import org.qedeq.kernel.base.module.ImportList; |
|
33 |
| import org.qedeq.kernel.base.module.Latex; |
|
34 |
| import org.qedeq.kernel.base.module.LatexList; |
|
35 |
| import org.qedeq.kernel.base.module.LinkList; |
|
36 |
| import org.qedeq.kernel.base.module.LiteratureItem; |
|
37 |
| import org.qedeq.kernel.base.module.LiteratureItemList; |
|
38 |
| import org.qedeq.kernel.base.module.Location; |
|
39 |
| import org.qedeq.kernel.base.module.LocationList; |
|
40 |
| import org.qedeq.kernel.base.module.Node; |
|
41 |
| import org.qedeq.kernel.base.module.PredicateDefinition; |
|
42 |
| import org.qedeq.kernel.base.module.Proof; |
|
43 |
| import org.qedeq.kernel.base.module.ProofList; |
|
44 |
| import org.qedeq.kernel.base.module.Proposition; |
|
45 |
| import org.qedeq.kernel.base.module.Qedeq; |
|
46 |
| import org.qedeq.kernel.base.module.Rule; |
|
47 |
| import org.qedeq.kernel.base.module.Section; |
|
48 |
| import org.qedeq.kernel.base.module.SectionList; |
|
49 |
| import org.qedeq.kernel.base.module.Specification; |
|
50 |
| import org.qedeq.kernel.base.module.Subsection; |
|
51 |
| import org.qedeq.kernel.base.module.SubsectionList; |
|
52 |
| import org.qedeq.kernel.base.module.Term; |
|
53 |
| import org.qedeq.kernel.base.module.UsedByList; |
|
54 |
| import org.qedeq.kernel.base.module.VariableList; |
|
55 |
| import org.qedeq.kernel.bo.module.ModuleDataException; |
|
56 |
| import org.qedeq.kernel.context.ModuleContext; |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
| |
|
64 |
| |
|
65 |
| |
|
66 |
| public class QedeqNotNullTransverser implements QedeqTransverser { |
|
67 |
| |
|
68 |
| |
|
69 |
| private ModuleContext currentContext; |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| private QedeqVisitor visitor; |
|
76 |
| |
|
77 |
| |
|
78 |
| private boolean blocked; |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
26567
| public QedeqNotNullTransverser(final String globalContext, final QedeqVisitor visitor) {
|
|
87 |
26567
| currentContext = new ModuleContext(globalContext);
|
|
88 |
26567
| this.visitor = visitor;
|
|
89 |
| } |
|
90 |
| |
|
91 |
| |
|
92 |
26567
| public void accept(final Qedeq qedeq) throws ModuleDataException {
|
|
93 |
26567
| getCurrentContext().setLocationWithinModule("");
|
|
94 |
26567
| blocked = false;
|
|
95 |
26567
| if (qedeq == null) {
|
|
96 |
0
| return;
|
|
97 |
| } |
|
98 |
26567
| final String context = getCurrentContext().getLocationWithinModule();
|
|
99 |
26567
| visitor.visitEnter(qedeq);
|
|
100 |
26565
| if (qedeq.getHeader() != null) {
|
|
101 |
26565
| getCurrentContext().setLocationWithinModule(context + "getHeader()");
|
|
102 |
26565
| accept(qedeq.getHeader());
|
|
103 |
| } |
|
104 |
26101
| if (qedeq.getChapterList() != null) {
|
|
105 |
26101
| getCurrentContext().setLocationWithinModule(context + "getChapterList()");
|
|
106 |
26101
| accept(qedeq.getChapterList());
|
|
107 |
| } |
|
108 |
191
| if (qedeq.getLiteratureItemList() != null) {
|
|
109 |
179
| getCurrentContext().setLocationWithinModule(context + "getLiteratureItemList()");
|
|
110 |
179
| accept(qedeq.getLiteratureItemList());
|
|
111 |
| } |
|
112 |
21
| setLocationWithinModule(context);
|
|
113 |
21
| visitor.visitLeave(qedeq);
|
|
114 |
21
| setLocationWithinModule(context);
|
|
115 |
| } |
|
116 |
| |
|
117 |
26565
| public void accept(final Header header) throws ModuleDataException {
|
|
118 |
26565
| if (blocked || header == null) {
|
|
119 |
0
| return;
|
|
120 |
| } |
|
121 |
26565
| final String context = getCurrentContext().getLocationWithinModule();
|
|
122 |
26565
| visitor.visitEnter(header);
|
|
123 |
26541
| if (header.getSpecification() != null) {
|
|
124 |
26541
| setLocationWithinModule(context + ".getSpecification()");
|
|
125 |
26541
| accept(header.getSpecification());
|
|
126 |
| } |
|
127 |
26436
| if (header.getTitle() != null) {
|
|
128 |
26436
| setLocationWithinModule(context + ".getTitle()");
|
|
129 |
26436
| accept(header.getTitle());
|
|
130 |
| } |
|
131 |
26390
| if (header.getSummary() != null) {
|
|
132 |
26390
| setLocationWithinModule(context + ".getSummary()");
|
|
133 |
26390
| accept(header.getSummary());
|
|
134 |
| } |
|
135 |
26344
| if (header.getAuthorList() != null) {
|
|
136 |
26344
| setLocationWithinModule(context + ".getAuthorList()");
|
|
137 |
26344
| accept(header.getAuthorList());
|
|
138 |
| } |
|
139 |
26272
| if (header.getImportList() != null) {
|
|
140 |
23892
| setLocationWithinModule(context + ".getImportList()");
|
|
141 |
23892
| accept(header.getImportList());
|
|
142 |
| } |
|
143 |
26156
| if (header.getUsedByList() != null) {
|
|
144 |
2455
| setLocationWithinModule(context + ".getUsedByList()");
|
|
145 |
2455
| accept(header.getUsedByList());
|
|
146 |
| } |
|
147 |
26101
| setLocationWithinModule(context);
|
|
148 |
26101
| visitor.visitLeave(header);
|
|
149 |
26101
| setLocationWithinModule(context);
|
|
150 |
| } |
|
151 |
| |
|
152 |
2455
| public void accept(final UsedByList usedByList) throws ModuleDataException {
|
|
153 |
2455
| if (blocked || usedByList == null) {
|
|
154 |
2392
| return;
|
|
155 |
| } |
|
156 |
63
| final String context = getCurrentContext().getLocationWithinModule();
|
|
157 |
63
| visitor.visitEnter(usedByList);
|
|
158 |
53
| for (int i = 0; i < usedByList.size(); i++) {
|
|
159 |
53
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
160 |
53
| accept(usedByList.get(i));
|
|
161 |
| } |
|
162 |
8
| setLocationWithinModule(context);
|
|
163 |
8
| visitor.visitLeave(usedByList);
|
|
164 |
8
| setLocationWithinModule(context);
|
|
165 |
| } |
|
166 |
| |
|
167 |
23892
| public void accept(final ImportList importList) throws ModuleDataException {
|
|
168 |
23892
| if (blocked || importList == null) {
|
|
169 |
23734
| return;
|
|
170 |
| } |
|
171 |
158
| final String context = getCurrentContext().getLocationWithinModule();
|
|
172 |
158
| visitor.visitEnter(importList);
|
|
173 |
146
| for (int i = 0; i < importList.size(); i++) {
|
|
174 |
219
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
175 |
219
| accept(importList.get(i));
|
|
176 |
| } |
|
177 |
42
| setLocationWithinModule(context);
|
|
178 |
42
| visitor.visitLeave(importList);
|
|
179 |
42
| setLocationWithinModule(context);
|
|
180 |
| } |
|
181 |
| |
|
182 |
219
| public void accept(final Import imp) throws ModuleDataException {
|
|
183 |
219
| if (blocked || imp == null) {
|
|
184 |
66
| return;
|
|
185 |
| } |
|
186 |
153
| final String context = getCurrentContext().getLocationWithinModule();
|
|
187 |
153
| visitor.visitEnter(imp);
|
|
188 |
127
| if (imp.getSpecification() != null) {
|
|
189 |
127
| setLocationWithinModule(context + ".getSpecification()");
|
|
190 |
127
| accept(imp.getSpecification());
|
|
191 |
| } |
|
192 |
49
| setLocationWithinModule(context);
|
|
193 |
49
| visitor.visitLeave(imp);
|
|
194 |
49
| setLocationWithinModule(context);
|
|
195 |
| } |
|
196 |
| |
|
197 |
26721
| public void accept(final Specification specification) throws ModuleDataException {
|
|
198 |
26721
| if (blocked || specification == null) {
|
|
199 |
26116
| return;
|
|
200 |
| } |
|
201 |
605
| final String context = getCurrentContext().getLocationWithinModule();
|
|
202 |
605
| visitor.visitEnter(specification);
|
|
203 |
505
| if (specification.getLocationList() != null) {
|
|
204 |
505
| setLocationWithinModule(context + ".getLocationList()");
|
|
205 |
505
| accept(specification.getLocationList());
|
|
206 |
| } |
|
207 |
377
| setLocationWithinModule(context);
|
|
208 |
377
| visitor.visitLeave(specification);
|
|
209 |
377
| setLocationWithinModule(context);
|
|
210 |
| } |
|
211 |
| |
|
212 |
505
| public void accept(final LocationList locationList) throws ModuleDataException {
|
|
213 |
505
| if (blocked || locationList == null) {
|
|
214 |
335
| return;
|
|
215 |
| } |
|
216 |
170
| final String context = getCurrentContext().getLocationWithinModule();
|
|
217 |
170
| visitor.visitEnter(locationList);
|
|
218 |
118
| for (int i = 0; i < locationList.size(); i++) {
|
|
219 |
118
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
220 |
118
| accept(locationList.get(i));
|
|
221 |
| } |
|
222 |
42
| setLocationWithinModule(context);
|
|
223 |
42
| visitor.visitLeave(locationList);
|
|
224 |
42
| setLocationWithinModule(context);
|
|
225 |
| } |
|
226 |
| |
|
227 |
118
| public void accept(final Location location) throws ModuleDataException {
|
|
228 |
118
| if (blocked || location == null) {
|
|
229 |
0
| return;
|
|
230 |
| } |
|
231 |
118
| final String context = getCurrentContext().getLocationWithinModule();
|
|
232 |
118
| visitor.visitEnter(location);
|
|
233 |
42
| setLocationWithinModule(context);
|
|
234 |
42
| visitor.visitLeave(location);
|
|
235 |
42
| setLocationWithinModule(context);
|
|
236 |
| } |
|
237 |
| |
|
238 |
26344
| public void accept(final AuthorList authorList) throws ModuleDataException {
|
|
239 |
26344
| if (blocked || authorList == null) {
|
|
240 |
26080
| return;
|
|
241 |
| } |
|
242 |
264
| final String context = getCurrentContext().getLocationWithinModule();
|
|
243 |
264
| visitor.visitEnter(authorList);
|
|
244 |
240
| for (int i = 0; i < authorList.size(); i++) {
|
|
245 |
240
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
246 |
240
| accept(authorList.get(i));
|
|
247 |
| } |
|
248 |
192
| setLocationWithinModule(context);
|
|
249 |
192
| visitor.visitLeave(authorList);
|
|
250 |
192
| setLocationWithinModule(context);
|
|
251 |
| } |
|
252 |
| |
|
253 |
240
| public void accept(final Author author) throws ModuleDataException {
|
|
254 |
240
| if (blocked || author == null) {
|
|
255 |
171
| return;
|
|
256 |
| } |
|
257 |
69
| final String context = getCurrentContext().getLocationWithinModule();
|
|
258 |
69
| visitor.visitEnter(author);
|
|
259 |
34
| if (author.getName() != null) {
|
|
260 |
34
| setLocationWithinModule(context + ".getName()");
|
|
261 |
34
| accept(author.getName());
|
|
262 |
| } |
|
263 |
21
| setLocationWithinModule(context);
|
|
264 |
21
| visitor.visitLeave(author);
|
|
265 |
21
| setLocationWithinModule(context);
|
|
266 |
| } |
|
267 |
| |
|
268 |
26101
| public void accept(final ChapterList chapterList) throws ModuleDataException {
|
|
269 |
26101
| if (blocked || chapterList == null) {
|
|
270 |
0
| return;
|
|
271 |
| } |
|
272 |
26101
| final String context = getCurrentContext().getLocationWithinModule();
|
|
273 |
26101
| visitor.visitEnter(chapterList);
|
|
274 |
26089
| for (int i = 0; i < chapterList.size(); i++) {
|
|
275 |
106676
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
276 |
106676
| accept(chapterList.get(i));
|
|
277 |
| } |
|
278 |
191
| setLocationWithinModule(context);
|
|
279 |
191
| visitor.visitLeave(chapterList);
|
|
280 |
191
| setLocationWithinModule(context);
|
|
281 |
| } |
|
282 |
| |
|
283 |
106676
| public void accept(final Chapter chapter) throws ModuleDataException {
|
|
284 |
106676
| if (blocked || chapter == null) {
|
|
285 |
1260
| return;
|
|
286 |
| } |
|
287 |
105416
| final String context = getCurrentContext().getLocationWithinModule();
|
|
288 |
105416
| visitor.visitEnter(chapter);
|
|
289 |
105282
| if (chapter.getTitle() != null) {
|
|
290 |
105282
| setLocationWithinModule(context + ".getTitle()");
|
|
291 |
105282
| accept(chapter.getTitle());
|
|
292 |
| } |
|
293 |
105048
| if (chapter.getIntroduction() != null) {
|
|
294 |
105048
| setLocationWithinModule(context + ".getIntroduction()");
|
|
295 |
105048
| accept(chapter.getIntroduction());
|
|
296 |
| } |
|
297 |
104824
| if (chapter.getSectionList() != null) {
|
|
298 |
53433
| setLocationWithinModule(context + ".getSectionList()");
|
|
299 |
53433
| accept(chapter.getSectionList());
|
|
300 |
| } |
|
301 |
79518
| setLocationWithinModule(context);
|
|
302 |
79518
| visitor.visitLeave(chapter);
|
|
303 |
79518
| setLocationWithinModule(context);
|
|
304 |
| } |
|
305 |
| |
|
306 |
179
| public void accept(final LiteratureItemList literatureItemList)
|
|
307 |
| throws ModuleDataException { |
|
308 |
179
| if (blocked || literatureItemList == null) {
|
|
309 |
0
| return;
|
|
310 |
| } |
|
311 |
179
| final String context = getCurrentContext().getLocationWithinModule();
|
|
312 |
179
| visitor.visitEnter(literatureItemList);
|
|
313 |
173
| for (int i = 0; i < literatureItemList.size(); i++) {
|
|
314 |
567
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
315 |
567
| accept(literatureItemList.get(i));
|
|
316 |
| } |
|
317 |
9
| setLocationWithinModule(context);
|
|
318 |
9
| visitor.visitLeave(literatureItemList);
|
|
319 |
9
| setLocationWithinModule(context);
|
|
320 |
| } |
|
321 |
| |
|
322 |
567
| public void accept(final LiteratureItem item) throws ModuleDataException {
|
|
323 |
567
| if (blocked || item == null) {
|
|
324 |
0
| return;
|
|
325 |
| } |
|
326 |
567
| final String context = getCurrentContext().getLocationWithinModule();
|
|
327 |
567
| visitor.visitEnter(item);
|
|
328 |
501
| if (item.getItem() != null) {
|
|
329 |
501
| setLocationWithinModule(context + ".getItem()");
|
|
330 |
501
| accept(item.getItem());
|
|
331 |
| } |
|
332 |
403
| setLocationWithinModule(context);
|
|
333 |
403
| visitor.visitLeave(item);
|
|
334 |
403
| setLocationWithinModule(context);
|
|
335 |
| } |
|
336 |
| |
|
337 |
53433
| public void accept(final SectionList sectionList) throws ModuleDataException {
|
|
338 |
53433
| if (blocked || sectionList == null) {
|
|
339 |
28066
| return;
|
|
340 |
| } |
|
341 |
25367
| final String context = getCurrentContext().getLocationWithinModule();
|
|
342 |
25367
| visitor.visitEnter(sectionList);
|
|
343 |
25300
| for (int i = 0; i < sectionList.size(); i++) {
|
|
344 |
67035
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
345 |
67035
| accept(sectionList.get(i));
|
|
346 |
| } |
|
347 |
61
| setLocationWithinModule(context);
|
|
348 |
61
| visitor.visitLeave(sectionList);
|
|
349 |
61
| setLocationWithinModule(context);
|
|
350 |
| } |
|
351 |
| |
|
352 |
67035
| public void accept(final Section section) throws ModuleDataException {
|
|
353 |
67035
| if (blocked || section == null) {
|
|
354 |
0
| return;
|
|
355 |
| } |
|
356 |
67035
| final String context = getCurrentContext().getLocationWithinModule();
|
|
357 |
67035
| visitor.visitEnter(section);
|
|
358 |
66822
| if (section.getTitle() != null) {
|
|
359 |
66822
| setLocationWithinModule(context + ".getTitle()");
|
|
360 |
66822
| accept(section.getTitle());
|
|
361 |
| } |
|
362 |
66372
| if (section.getIntroduction() != null) {
|
|
363 |
66372
| setLocationWithinModule(context + ".getIntroduction()");
|
|
364 |
66372
| accept(section.getIntroduction());
|
|
365 |
| } |
|
366 |
65972
| if (section.getSubsectionList() != null) {
|
|
367 |
55024
| setLocationWithinModule(context + ".getSubsectionList()");
|
|
368 |
55024
| accept(section.getSubsectionList());
|
|
369 |
| } |
|
370 |
41796
| setLocationWithinModule(context);
|
|
371 |
41796
| visitor.visitLeave(section);
|
|
372 |
41796
| setLocationWithinModule(context);
|
|
373 |
| } |
|
374 |
| |
|
375 |
55024
| public void accept(final SubsectionList subsectionList) throws ModuleDataException {
|
|
376 |
55024
| if (blocked || subsectionList == null) {
|
|
377 |
30750
| return;
|
|
378 |
| } |
|
379 |
24274
| final String context = getCurrentContext().getLocationWithinModule();
|
|
380 |
24274
| visitor.visitEnter(subsectionList);
|
|
381 |
24161
| for (int i = 0; i < subsectionList.size(); i++) {
|
|
382 |
131992
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
383 |
| |
|
384 |
131992
| if (subsectionList.get(i) instanceof Subsection) {
|
|
385 |
3467
| accept((Subsection) subsectionList.get(i));
|
|
386 |
128525
| } else if (subsectionList.get(i) instanceof Node) {
|
|
387 |
128525
| accept((Node) subsectionList.get(i));
|
|
388 |
0
| } else if (subsectionList.get(i) == null) {
|
|
389 |
| |
|
390 |
| } else { |
|
391 |
0
| throw new IllegalArgumentException("unexpected subsection type: "
|
|
392 |
| + subsectionList.get(i).getClass()); |
|
393 |
| } |
|
394 |
| } |
|
395 |
98
| setLocationWithinModule(context);
|
|
396 |
98
| visitor.visitLeave(subsectionList);
|
|
397 |
98
| setLocationWithinModule(context);
|
|
398 |
| } |
|
399 |
| |
|
400 |
3467
| public void accept(final Subsection subsection) throws ModuleDataException {
|
|
401 |
3467
| if (blocked || subsection == null) {
|
|
402 |
0
| return;
|
|
403 |
| } |
|
404 |
3467
| final String context = getCurrentContext().getLocationWithinModule();
|
|
405 |
3467
| visitor.visitEnter(subsection);
|
|
406 |
3369
| if (subsection.getTitle() != null) {
|
|
407 |
1520
| setLocationWithinModule(context + ".getTitle()");
|
|
408 |
1520
| accept(subsection.getTitle());
|
|
409 |
| } |
|
410 |
3243
| if (subsection.getLatex() != null) {
|
|
411 |
3243
| setLocationWithinModule(context + ".getLatex()");
|
|
412 |
3243
| accept(subsection.getLatex());
|
|
413 |
| } |
|
414 |
3087
| setLocationWithinModule(context);
|
|
415 |
3087
| visitor.visitLeave(subsection);
|
|
416 |
3087
| setLocationWithinModule(context);
|
|
417 |
| } |
|
418 |
| |
|