|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| package org.qedeq.kernel.bo.load; |
|
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.control.QedeqBoDuplicateLanguageChecker; |
|
56 |
| import org.qedeq.kernel.bo.control.QedeqBoFormalLogicChecker; |
|
57 |
| import org.qedeq.kernel.bo.module.IllegalModuleDataException; |
|
58 |
| import org.qedeq.kernel.bo.module.ModuleContext; |
|
59 |
| import org.qedeq.kernel.bo.module.ModuleDataException; |
|
60 |
| import org.qedeq.kernel.bo.module.QedeqBo; |
|
61 |
| import org.qedeq.kernel.dto.list.DefaultAtom; |
|
62 |
| import org.qedeq.kernel.dto.list.DefaultElementList; |
|
63 |
| import org.qedeq.kernel.dto.module.AuthorListVo; |
|
64 |
| import org.qedeq.kernel.dto.module.AuthorVo; |
|
65 |
| import org.qedeq.kernel.dto.module.AxiomVo; |
|
66 |
| import org.qedeq.kernel.dto.module.ChapterListVo; |
|
67 |
| import org.qedeq.kernel.dto.module.ChapterVo; |
|
68 |
| import org.qedeq.kernel.dto.module.FormulaVo; |
|
69 |
| import org.qedeq.kernel.dto.module.FunctionDefinitionVo; |
|
70 |
| import org.qedeq.kernel.dto.module.HeaderVo; |
|
71 |
| import org.qedeq.kernel.dto.module.ImportListVo; |
|
72 |
| import org.qedeq.kernel.dto.module.ImportVo; |
|
73 |
| import org.qedeq.kernel.dto.module.LatexListVo; |
|
74 |
| import org.qedeq.kernel.dto.module.LatexVo; |
|
75 |
| import org.qedeq.kernel.dto.module.LinkListVo; |
|
76 |
| import org.qedeq.kernel.dto.module.LiteratureItemListVo; |
|
77 |
| import org.qedeq.kernel.dto.module.LiteratureItemVo; |
|
78 |
| import org.qedeq.kernel.dto.module.LocationListVo; |
|
79 |
| import org.qedeq.kernel.dto.module.LocationVo; |
|
80 |
| import org.qedeq.kernel.dto.module.NodeVo; |
|
81 |
| import org.qedeq.kernel.dto.module.PredicateDefinitionVo; |
|
82 |
| import org.qedeq.kernel.dto.module.ProofListVo; |
|
83 |
| import org.qedeq.kernel.dto.module.ProofVo; |
|
84 |
| import org.qedeq.kernel.dto.module.PropositionVo; |
|
85 |
| import org.qedeq.kernel.dto.module.RuleVo; |
|
86 |
| import org.qedeq.kernel.dto.module.SectionListVo; |
|
87 |
| import org.qedeq.kernel.dto.module.SectionVo; |
|
88 |
| import org.qedeq.kernel.dto.module.SpecificationVo; |
|
89 |
| import org.qedeq.kernel.dto.module.SubsectionListVo; |
|
90 |
| import org.qedeq.kernel.dto.module.SubsectionVo; |
|
91 |
| import org.qedeq.kernel.dto.module.TermVo; |
|
92 |
| import org.qedeq.kernel.dto.module.UsedByListVo; |
|
93 |
| import org.qedeq.kernel.dto.module.VariableListVo; |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
| |
|
104 |
| |
|
105 |
| |
|
106 |
| |
|
107 |
| |
|
108 |
| |
|
109 |
| |
|
110 |
| public class QedeqBoFactory { |
|
111 |
| |
|
112 |
| |
|
113 |
| private DefaultQedeqBo qedeq; |
|
114 |
| |
|
115 |
| |
|
116 |
| private Qedeq original; |
|
117 |
| |
|
118 |
| |
|
119 |
| private ModuleContext currentContext; |
|
120 |
| |
|
121 |
| |
|
122 |
| |
|
123 |
| |
|
124 |
| |
|
125 |
| |
|
126 |
29
| protected QedeqBoFactory(final String globalContext) {
|
|
127 |
29
| currentContext = new ModuleContext(globalContext);
|
|
128 |
| } |
|
129 |
| |
|
130 |
| |
|
131 |
| |
|
132 |
| |
|
133 |
| |
|
134 |
| |
|
135 |
| |
|
136 |
| |
|
137 |
| |
|
138 |
| |
|
139 |
| |
|
140 |
| |
|
141 |
| |
|
142 |
| |
|
143 |
| |
|
144 |
18
| public static DefaultQedeqBo createQedeq(final String globalContext, final Qedeq original)
|
|
145 |
| throws ModuleDataException { |
|
146 |
18
| final QedeqBoFactory creator = new QedeqBoFactory(globalContext);
|
|
147 |
18
| DefaultQedeqBo bo = creator.create(original);
|
|
148 |
| |
|
149 |
| |
|
150 |
| |
|
151 |
| |
|
152 |
17
| QedeqBoFormalLogicChecker.check(globalContext, bo);
|
|
153 |
10
| QedeqBoDuplicateLanguageChecker.check(globalContext, bo);
|
|
154 |
9
| return bo;
|
|
155 |
| } |
|
156 |
| |
|
157 |
| |
|
158 |
| |
|
159 |
| |
|
160 |
| |
|
161 |
| |
|
162 |
| |
|
163 |
| |
|
164 |
| |
|
165 |
| |
|
166 |
| |
|
167 |
| |
|
168 |
| |
|
169 |
| |
|
170 |
| |
|
171 |
29
| protected final DefaultQedeqBo create(final Qedeq original) throws IllegalModuleDataException {
|
|
172 |
29
| this.original = original;
|
|
173 |
29
| getCurrentContext().setLocationWithinModule("");
|
|
174 |
29
| if (original == null) {
|
|
175 |
0
| qedeq = null;
|
|
176 |
0
| return qedeq;
|
|
177 |
| } |
|
178 |
29
| qedeq = new DefaultQedeqBo();
|
|
179 |
29
| final String context = getCurrentContext().getLocationWithinModule();
|
|
180 |
29
| if (original.getHeader() != null) {
|
|
181 |
29
| getCurrentContext().setLocationWithinModule(context + "getHeader()");
|
|
182 |
29
| qedeq.setHeader(create(original.getHeader()));
|
|
183 |
| } |
|
184 |
29
| if (original.getChapterList() != null) {
|
|
185 |
29
| getCurrentContext().setLocationWithinModule(context + "getChapterList()");
|
|
186 |
29
| qedeq.setChapterList(create(original.getChapterList()));
|
|
187 |
| } |
|
188 |
27
| if (original.getLiteratureItemList() != null) {
|
|
189 |
8
| getCurrentContext().setLocationWithinModule(context + "getLiteratureItemList()");
|
|
190 |
8
| qedeq.setLiteratureItemList(create(original.getLiteratureItemList()));
|
|
191 |
| } |
|
192 |
27
| return qedeq;
|
|
193 |
| } |
|
194 |
| |
|
195 |
| |
|
196 |
| |
|
197 |
| |
|
198 |
| |
|
199 |
| |
|
200 |
| |
|
201 |
| |
|
202 |
| |
|
203 |
| |
|
204 |
| |
|
205 |
| |
|
206 |
| |
|
207 |
| |
|
208 |
29
| private final HeaderVo create(final Header header)
|
|
209 |
| throws IllegalModuleDataException { |
|
210 |
29
| if (header == null) {
|
|
211 |
0
| return null;
|
|
212 |
| } |
|
213 |
29
| final HeaderVo h = new HeaderVo();
|
|
214 |
29
| final String context = getCurrentContext().getLocationWithinModule();
|
|
215 |
29
| if (header.getTitle() != null) {
|
|
216 |
29
| setLocationWithinModule(context + ".getTitle()");
|
|
217 |
29
| h.setTitle(create(header.getTitle()));
|
|
218 |
| } |
|
219 |
29
| if (header.getAuthorList() != null) {
|
|
220 |
29
| setLocationWithinModule(context + ".getAuthorList()");
|
|
221 |
29
| h.setAuthorList(create(header.getAuthorList()));
|
|
222 |
| } |
|
223 |
29
| if (header.getSummary() != null) {
|
|
224 |
29
| setLocationWithinModule(context + ".getSummary()");
|
|
225 |
29
| h.setSummary(create(header.getSummary()));
|
|
226 |
| } |
|
227 |
29
| if (header.getEmail() != null) {
|
|
228 |
29
| setLocationWithinModule(context + ".getEmail()");
|
|
229 |
29
| h.setEmail(header.getEmail());
|
|
230 |
| } |
|
231 |
29
| if (header.getSpecification() != null) {
|
|
232 |
29
| setLocationWithinModule(context + ".getSpecification()");
|
|
233 |
29
| h.setSpecification(create(header.getSpecification()));
|
|
234 |
| } |
|
235 |
29
| if (header.getImportList() != null) {
|
|
236 |
15
| setLocationWithinModule(context + ".getImportList()");
|
|
237 |
15
| h.setImportList(create(header.getImportList()));
|
|
238 |
| } |
|
239 |
29
| if (header.getUsedByList() != null) {
|
|
240 |
13
| setLocationWithinModule(context + ".getUsedByList()");
|
|
241 |
13
| h.setUsedByList(create(header.getUsedByList()));
|
|
242 |
| } |
|
243 |
29
| setLocationWithinModule(context);
|
|
244 |
29
| return h;
|
|
245 |
| } |
|
246 |
| |
|
247 |
| |
|
248 |
| |
|
249 |
| |
|
250 |
| |
|
251 |
| |
|
252 |
| |
|
253 |
| |
|
254 |
| |
|
255 |
| |
|
256 |
| |
|
257 |
| |
|
258 |
| |
|
259 |
13
| private final UsedByListVo create(final UsedByList usedByList) {
|
|
260 |
13
| if (usedByList == null) {
|
|
261 |
0
| return null;
|
|
262 |
| } |
|
263 |
13
| final String context = getCurrentContext().getLocationWithinModule();
|
|
264 |
13
| final UsedByListVo list = new UsedByListVo();
|
|
265 |
13
| for (int i = 0; i < usedByList.size(); i++) {
|
|
266 |
13
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
267 |
13
| list.add(create(usedByList.get(i)));
|
|
268 |
| } |
|
269 |
13
| setLocationWithinModule(context);
|
|
270 |
13
| return list;
|
|
271 |
| } |
|
272 |
| |
|
273 |
15
| private final ImportListVo create(final ImportList importList) {
|
|
274 |
15
| if (importList == null) {
|
|
275 |
0
| return null;
|
|
276 |
| } |
|
277 |
15
| final String context = getCurrentContext().getLocationWithinModule();
|
|
278 |
15
| final ImportListVo list = new ImportListVo();
|
|
279 |
15
| for (int i = 0; i < importList.size(); i++) {
|
|
280 |
25
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
281 |
25
| list.add(create(importList.get(i)));
|
|
282 |
| } |
|
283 |
15
| setLocationWithinModule(context);
|
|
284 |
15
| return list;
|
|
285 |
| } |
|
286 |
| |
|
287 |
25
| private final ImportVo create(final Import imp) {
|
|
288 |
25
| if (imp == null) {
|
|
289 |
0
| return null;
|
|
290 |
| } |
|
291 |
25
| final ImportVo i = new ImportVo();
|
|
292 |
25
| final String context = getCurrentContext().getLocationWithinModule();
|
|
293 |
25
| if (imp.getLabel() != null) {
|
|
294 |
25
| setLocationWithinModule(context + ".getLabel()");
|
|
295 |
25
| i.setLabel(imp.getLabel());
|
|
296 |
| } |
|
297 |
25
| if (imp.getSpecification() != null) {
|
|
298 |
25
| setLocationWithinModule(context + ".getSpecification()");
|
|
299 |
25
| i.setSpecification(create(imp.getSpecification()));
|
|
300 |
| } |
|
301 |
25
| setLocationWithinModule(context);
|
|
302 |
25
| return i;
|
|
303 |
| } |
|
304 |
| |
|
305 |
67
| private final SpecificationVo create(final Specification specification) {
|
|
306 |
67
| if (specification == null) {
|
|
307 |
0
| return null;
|
|
308 |
| } |
|
309 |
67
| final SpecificationVo s = new SpecificationVo();
|
|
310 |
67
| final String context = getCurrentContext().getLocationWithinModule();
|
|
311 |
67
| if (specification.getName() != null) {
|
|
312 |
67
| setLocationWithinModule(context + ".getName()");
|
|
313 |
67
| s.setName(specification.getName());
|
|
314 |
| } |
|
315 |
67
| if (specification.getRuleVersion() != null) {
|
|
316 |
67
| setLocationWithinModule(context + ".getRuleVersion()");
|
|
317 |
67
| s.setRuleVersion(specification.getRuleVersion());
|
|
318 |
| } |
|
319 |
67
| if (specification.getLocationList() != null) {
|
|
320 |
67
| setLocationWithinModule(context + ".getLocationList()");
|
|
321 |
67
| s.setLocationList(create(specification.getLocationList()));
|
|
322 |
| } |
|
323 |
67
| setLocationWithinModule(context);
|
|
324 |
67
| return s;
|
|
325 |
| } |
|
326 |
| |
|
327 |
67
| private final LocationListVo create(final LocationList locationList) {
|
|
328 |
67
| if (locationList == null) {
|
|
329 |
0
| return null;
|
|
330 |
| } |
|
331 |
67
| final LocationListVo list = new LocationListVo();
|
|
332 |
67
| final String context = getCurrentContext().getLocationWithinModule();
|
|
333 |
67
| for (int i = 0; i < locationList.size(); i++) {
|
|
334 |
67
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
335 |
67
| list.add(create(locationList.get(i)));
|
|
336 |
| } |
|
337 |
67
| setLocationWithinModule(context);
|
|
338 |
67
| return list;
|
|
339 |
| } |
|
340 |
| |
|
341 |
67
| private final LocationVo create(final Location location) {
|
|
342 |
67
| if (location == null) {
|
|
343 |
0
| return null;
|
|
344 |
| } |
|
345 |
67
| final LocationVo loc = new LocationVo();
|
|
346 |
67
| final String context = getCurrentContext().getLocationWithinModule();
|
|
347 |
67
| if (location.getLocation() != null) {
|
|
348 |
67
| setLocationWithinModule(context + ".getLocation()");
|
|
349 |
67
| loc.setLocation(location.getLocation());
|
|
350 |
| } |
|
351 |
67
| setLocationWithinModule(context);
|
|
352 |
67
| return loc;
|
|
353 |
| } |
|
354 |
| |
|
355 |
29
| private final AuthorListVo create(final AuthorList authorList) {
|
|
356 |
29
| if (authorList == null) {
|
|
357 |
0
| return null;
|
|
358 |
| } |
|
359 |
29
| final AuthorListVo list = new AuthorListVo();
|
|
360 |
29
| final String context = getCurrentContext().getLocationWithinModule();
|
|
361 |
29
| for (int i = 0; i < authorList.size(); i++) {
|
|
362 |
29
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
363 |
29
| list.add(create(authorList.get(i)));
|
|
364 |
| } |
|
365 |
29
| setLocationWithinModule(context);
|
|
366 |
29
| return list;
|
|
367 |
| } |
|
368 |
| |
|
369 |
29
| private final AuthorVo create(final Author author) {
|
|
370 |
29
| if (author == null) {
|
|
371 |
0
| return null;
|
|
372 |
| } |
|
373 |
29
| final AuthorVo a = new AuthorVo();
|
|
374 |
29
| final String context = getCurrentContext().getLocationWithinModule();
|
|
375 |
29
| if (author.getName() != null) {
|
|
376 |
29
| setLocationWithinModule(context + ".getName()");
|
|
377 |
29
| a.setName(create(author.getName()));
|
|
378 |
| } |
|
379 |
29
| if (author.getEmail() != null) {
|
|
380 |
29
| setLocationWithinModule(context + ".getEmail()");
|
|
381 |
29
| a.setEmail(author.getEmail());
|
|
382 |
| } |
|
383 |
29
| setLocationWithinModule(context);
|
|
384 |
29
| return a;
|
|
385 |
| } |
|
386 |
| |
|
387 |
29
| private final ChapterListVo create(final ChapterList chapterList)
|
|
388 |
| throws IllegalModuleDataException { |
|
389 |
29
| if (chapterList == null) {
|
|
390 |
0
| return null;
|
|
391 |
| } |
|
392 |
29
| final ChapterListVo list = new ChapterListVo();
|
|
393 |
29
| final String context = getCurrentContext().getLocationWithinModule();
|
|
394 |
29
| for (int i = 0; i < chapterList.size(); i++) {
|
|
395 |
115
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
396 |
115
| list.add(create(chapterList.get(i)));
|
|
397 |
| } |
|
398 |
27
| setLocationWithinModule(context);
|
|
399 |
27
| return list;
|
|
400 |
| } |
|
401 |
| |
|
402 |
115
| private final ChapterVo create(final Chapter chapter)
|
|
403 |
| throws IllegalModuleDataException { |
|
404 |
115
| if (chapter == null) {
|
|
405 |
0
| return null;
|
|
406 |
| } |
|
407 |
115
| final ChapterVo c = new ChapterVo();
|
|
408 |
115
| final String context = getCurrentContext().getLocationWithinModule();
|
|
409 |
115
| if (chapter.getTitle() != null) {
|
|
410 |
115
| setLocationWithinModule(context + ".getTitle()");
|
|
411 |
115
| c.setTitle(create(chapter.getTitle()));
|
|
412 |
| } |
|
413 |
115
| if (chapter.getNoNumber() != null) {
|
|
414 |
36
| setLocationWithinModule(context + ".getNoNumber()");
|
|
415 |
36
| c.setNoNumber(chapter.getNoNumber());
|
|
416 |
| } |
|
417 |
115
| if (chapter.getIntroduction() != null) {
|
|
418 |
111
| setLocationWithinModule(context + ".getIntroduction()");
|
|
419 |
111
| c.setIntroduction(create(chapter.getIntroduction()));
|
|
420 |
| } |
|
421 |
115
| if (chapter.getSectionList() != null) {
|
|
422 |
72
| setLocationWithinModule(context + ".getSectionList()");
|
|
423 |
72
| c.setSectionList(create(chapter.getSectionList()));
|
|
424 |
| } |
|
425 |
113
| setLocationWithinModule(context);
|
|
426 |
113
| return c;
|
|
427 |
| } |
|
428 |
| |
|
429 |
8
| private LiteratureItemListVo create(final LiteratureItemList literatureItemList)
|
|
430 |
| throws IllegalModuleDataException { |
|
431 |
8
| if (literatureItemList == null) {
|
|
432 |
0
| return null;
|
|
433 |
| } |
|
434 |
8
| final LiteratureItemListVo list = new LiteratureItemListVo();
|
|
435 |
8
| final String context = getCurrentContext().getLocationWithinModule();
|
|
436 |
8
| for (int i = 0; i < literatureItemList.size(); i++) {
|
|
437 |
36
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
438 |
36
| list.add(create(literatureItemList.get(i)));
|
|
439 |
| } |
|
440 |
8
| setLocationWithinModule(context);
|
|
441 |
8
| return list;
|
|
442 |
| } |
|
443 |
| |
|
444 |
36
| private LiteratureItemVo create(final LiteratureItem item)
|
|
445 |
| throws IllegalModuleDataException { |
|
446 |
36
| if (item == null) {
|
|
447 |
0
| return null;
|
|
448 |
| } |
|
449 |
36
| final LiteratureItemVo it = new LiteratureItemVo();
|
|
450 |
36
| final String context = getCurrentContext().getLocationWithinModule();
|
|
451 |
36
| if (item.getLabel() != null) {
|
|
452 |
36
| setLocationWithinModule(context + ".getLabel()");
|
|
453 |
36
| it.setLabel(item.getLabel());
|
|
454 |
| } |
|
455 |
36
| if (item.getItem() != null) {
|
|
456 |
36
| setLocationWithinModule(context + ".getItem()");
|
|
457 |
36
| it.setItem(create(item.getItem()));
|
|
458 |
| } |
|
459 |
36
| setLocationWithinModule(context);
|
|
460 |
36
| return it;
|
|
461 |
| |
|
462 |
| } |
|
463 |
| |
|
464 |
72
| private final SectionListVo create(final SectionList sectionList)
|
|
465 |
| throws IllegalModuleDataException { |
|
466 |
72
| if (sectionList == null) {
|
|
467 |
0
| return null;
|
|
468 |
| } |
|
469 |
72
| final SectionListVo list = new SectionListVo();
|
|
470 |
72
| final String context = getCurrentContext().getLocationWithinModule();
|
|
471 |
72
| for (int i = 0; i < sectionList.size(); i++) {
|
|
472 |
204
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
473 |
204
| list.add(create(sectionList.get(i)));
|
|
474 |
| } |
|
475 |
70
| setLocationWithinModule(context);
|
|
476 |
70
| return list;
|
|
477 |
| } |
|
478 |
| |
|
479 |
204
| private final SectionVo create(final Section section)
|
|
480 |
| throws IllegalModuleDataException { |
|
481 |
204
| if (section == null) {
|
|
482 |
0
| return null;
|
|
483 |
| } |
|
484 |
204
| final SectionVo s = new SectionVo();
|
|
485 |
204
| final String context = getCurrentContext().getLocationWithinModule();
|
|
486 |
204
| if (section.getTitle() != null) {
|
|
487 |
204
| setLocationWithinModule(context + ".getTitle()");
|
|
488 |
204
| s.setTitle(create(section.getTitle()));
|
|
489 |
| } |
|
490 |
204
| if (section.getNoNumber() != null) {
|
|
491 |
0
| setLocationWithinModule(context + ".getNoNumber()");
|
|
492 |
0
| s.setNoNumber(section.getNoNumber());
|
|
493 |
| } |
|
494 |
204
| if (section.getIntroduction() != null) {
|
|
495 |
200
| setLocationWithinModule(context + ".getIntroduction()");
|
|
496 |
200
| s.setIntroduction(create(section.getIntroduction()));
|
|
497 |
| } |
|
498 |
204
| if (section.getSubsectionList() != null) {
|
|
499 |
104
| setLocationWithinModule(context + ".getSubsectionList()");
|
|
500 |
104
| s.setSubsectionList(create(section.getSubsectionList()));
|
|
501 |
| } |
|
502 |
202
| setLocationWithinModule(context);
|
|
503 |
202
| return s;
|
|
504 |
| } |
|
505 |
| |
|
506 |
104
| private final SubsectionListVo create(final SubsectionList subsectionList)
|
|
507 |
| throws IllegalModuleDataException { |
|
508 |
104
| if (subsectionList == null) {
|
|
509 |
0
| return null;
|
|
510 |
| } |
|
511 |
104
| final SubsectionListVo list = new SubsectionListVo();
|
|
512 |
104
| final String context = getCurrentContext().getLocationWithinModule();
|
|
513 |
104
| for (int i = 0; i < subsectionList.size(); i++) {
|
|
514 |
620
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
515 |
| |
|
516 |
620
| if (subsectionList.get(i) instanceof Subsection) {
|
|
517 |
81
| list.add(create((Subsection) subsectionList.get(i)));
|
|
518 |
539
| } else if (subsectionList.get(i) instanceof Node) {
|
|
519 |
539
| list.add(create((Node) subsectionList.get(i)));
|
|
520 |
| } else { |
|
521 |
0
| throw new IllegalArgumentException("unexpected subsection type: "
|
|
522 |
| + subsectionList.get(i).getClass()); |
|
523 |
| } |
|
524 |
| } |
|
525 |
102
| setLocationWithinModule(context);
|
|
526 |
102
| return list;
|
|
527 |
| } |
|
528 |
| |
|
529 |
81
| private final SubsectionVo create(final Subsection subsection) {
|
|
530 |
81
| if (subsection == null) {
|
|
531 |
0
| return null;
|
|
532 |
| } |
|
533 |
81
| final SubsectionVo s = new SubsectionVo();
|
|
534 |
81
| final String context = getCurrentContext().getLocationWithinModule();
|
|
535 |
81
| if (subsection.getTitle() != null) {
|
|
536 |
70
| setLocationWithinModule(context + ".getTitle()");
|
|
537 |
70
| s.setTitle(create(subsection.getTitle()));
|
|
538 |
| } |
|
539 |
81
| if (subsection.getLevel() != null) {
|
|
540 |
0
| setLocationWithinModule(context + ".getLevel()");
|
|
541 |
0
| s.setLevel(subsection.getLevel());
|
|
542 |
| } |
|
543 |
81
| if (subsection.getLatex() != null) {
|
|
544 |
81
| setLocationWithinModule(context + ".getLatex()");
|
|
545 |
81
| s.setLatex(create(subsection.getLatex()));
|
|
546 |
| } |
|
547 |
81
| setLocationWithinModule(context);
|
|
548 |
81
| return s;
|
|
549 |
| } |
|
550 |
| |
|
551 |
539
| private final NodeVo create(final Node node)
|
|
552 |
| throws IllegalModuleDataException { |
|
553 |
539
| if (node == null) {
|
|
554 |
0
| return null;
|
|
555 |
| } |
|
556 |
539
| final NodeVo n = new NodeVo();
|
|
557 |
539
| final String context = getCurrentContext().getLocationWithinModule();
|
|
558 |
539
| if (node.getName() != null) {
|
|
559 |
266
| setLocationWithinModule(context + ".getName()");
|
|
560 |
266
| n.setName(create(node.getName()));
|
|
561 |
| } |
|
562 |
539
| if (node.getId() != null) {
|
|
563 |
539
| setLocationWithinModule(context + ".getId()");
|
|
564 |
539
| n.setId(node.getId());
|
|
565 |
| } |
|
566 |
539
| if (node.getLevel() != null) {
|
|
567 |
363
| setLocationWithinModule(context + ".getLevel()");
|
|
568 |
363
| n.setLevel(node.getLevel());
|
|
569 |
| } |
|
570 |
539
| if (node.getTitle() != null) {
|
|
571 |
266
| setLocationWithinModule(context + ".getTitle()");
|
|
572 |
266
| n.setTitle(create(node.getTitle()));
|
|
573 |
| } |
|
574 |
539
| if (node.getPrecedingText() != null) {
|
|
575 |
517
| setLocationWithinModule(context + ".getPrecedingText()");
|
|
576 |
517
| n.setPrecedingText(create(node.getPrecedingText()));
|
|
577 |
| } |
|
578 |
539
| if (node.getNodeType() != null) {
|
|
579 |
539
| setLocationWithinModule(context + ".getNodeType()");
|
|
580 |
539
| if (node.getNodeType() instanceof Axiom) {
|
|
581 |
87
| setLocationWithinModule(context + ".getNodeType().getAxiom()");
|
|
582 |
87
| n.setNodeType(create((Axiom) node.getNodeType()));
|
|
583 |
452
| } else if (node.getNodeType() instanceof PredicateDefinition) {
|
|
584 |
70
| setLocationWithinModule(context + ".getNodeType().getPredicateDefinition()");
|
|
585 |
70
| n.setNodeType(create((PredicateDefinition) node.getNodeType()));
|
|
586 |
382
| } else if (node.getNodeType() instanceof FunctionDefinition) {
|
|
587 |
80
| setLocationWithinModule(context + ".getNodeType().getFunctionDefinition()");
|
|
588 |
80
| n.setNodeType(create((FunctionDefinition) node.getNodeType()));
|
|
589 |
302
| } else if (node.getNodeType() instanceof Proposition) {
|
|
590 |
276
| setLocationWithinModule(context + ".getNodeType().getProposition()");
|
|
591 |
276
| n.setNodeType(create((Proposition) node.getNodeType()));
|
|
592 |
26
| } else if (node.getNodeType() instanceof Rule) {
|
|
593 |
26
| setLocationWithinModule(context + ".getNodeType().getRule()");
|
|
594 |
26
| n.setNodeType(create((Rule) node.getNodeType()));
|
|
595 |
| } else { |
|
596 |
0
| throw new IllegalArgumentException("unexpected node type: "
|
|
597 |
| + node.getNodeType().getClass()); |
|
598 |
| } |
|
599 |
| } |
|
600 |
539
| if (node.getSucceedingText() != null) {
|
|
601 |
116
| setLocationWithinModule(context + ".getSucceedingText()");
|
|
602 |
116
| n.setSucceedingText(create(node.getSucceedingText()));
|
|
603 |
| } |
|
604 |
539
| setLocationWithinModule(context);
|
|
605 |
539
| getQedeqCreated().getModuleLabels().addNode(getCurrentContext(), n);
|
|
606 |
537
| return n;
|
|
607 |
| } |
|
608 |
| |
|
609 |
87
| private final AxiomVo create(final Axiom axiom) {
|
|
610 |
87
| if (axiom == null) {
|
|
611 |
0
| return null;
|
|
612 |
| } |
|
613 |
87
| final AxiomVo a = new AxiomVo();
|
|
614 |
87
| final String context = getCurrentContext().getLocationWithinModule();
|
|
615 |
87
| if (axiom.getFormula() != null) {
|
|
616 |
87
| setLocationWithinModule(context + ".getFormula()");
|
|
617 |
87
| a.setFormula(create(axiom.getFormula()));
|
|
618 |
| } |
|
619 |
87
| if (axiom.getDescription() != null) {
|
|
620 |
0
| setLocationWithinModule(context + ".getDescription()");
|
|
621 |
0
| a.setDescription(create(axiom.getDescription()));
|
|
622 |
| } |
|
623 |
87
| setLocationWithinModule(context);
|
|
624 |
87
| return a;
|
|
625 |
| } |
|
626 |
| |
|
627 |
70
| private final PredicateDefinitionVo create(final PredicateDefinition definition) {
|
|
628 |
70
| if (definition == null) {
|
|
629 |
0
| return null;
|
|
630 |
| } |
|
631 |
70
| final PredicateDefinitionVo d = new PredicateDefinitionVo();
|
|
632 |
70
| final String context = getCurrentContext().getLocationWithinModule();
|
|
633 |
70
| if (definition.getLatexPattern() != null) {
|
|
634 |
70
| setLocationWithinModule(context + ".getLatexPattern()");
|
|
635 |
70
| d.setLatexPattern(definition.getLatexPattern());
|
|
636 |
| } |
|
637 |
70
| if (definition.getName() != null) {
|
|
638 |
70
| setLocationWithinModule(context + ".getName()");
|
|
639 |
70
| d.setName(definition.getName());
|
|
640 |
| } |
|
641 |
70
| if (definition.getArgumentNumber() != null) {
|
|
642 |
70
| setLocationWithinModule(context + ".getArgumentNumber()");
|
|
643 |
70
| d.setArgumentNumber(definition.getArgumentNumber());
|
|
644 |
| } |
|
645 |
70
| if (definition.getVariableList() != null) {
|
|
646 |
64
| setLocationWithinModule(context + ".getVariableList()");
|
|
647 |
64
| d.setVariableList(create(definition.getVariableList()));
|
|
648 |
| } |
|
649 |
70
| if (definition.getFormula() != null) {
|
|
650 |
55
| setLocationWithinModule(context + ".getFormula()");
|
|
651 |
55
| d.setFormula(create(definition.getFormula()));
|
|
652 |
| } |
|
653 |
70
| if (definition.getDescription() != null) {
|
|
654 |
0
| setLocationWithinModule(context + ".getDescription()");
|
|
655 |
0
| d.setDescription(create(definition.getDescription()));
|
|
656 |
| } |
|
657 |
70
| setLocationWithinModule(context);
|
|
658 |
70
| return d;
|
|
659 |
| } |
|
660 |
| |
|
661 |
80
| private final FunctionDefinitionVo create(final FunctionDefinition definition) {
|
|
662 |
80
| if (definition == null) {
|
|
663 |
0
| return null;
|
|
664 |
| } |
|
665 |
80
| final FunctionDefinitionVo d = new FunctionDefinitionVo();
|
|
666 |
80
| final String context = getCurrentContext().getLocationWithinModule();
|
|
667 |
80
| if (definition.getLatexPattern() != null) {
|
|
668 |
80
| setLocationWithinModule(context + ".getLatexPattern()");
|
|
669 |
80
| d.setLatexPattern(definition.getLatexPattern());
|
|
670 |
| } |
|
671 |
80
| if (definition.getArgumentNumber() != null) {
|
|
672 |
80
| setLocationWithinModule(context + ".getArgumentNumber()");
|
|
673 |
80
| d.setArgumentNumber(definition.getArgumentNumber());
|
|
674 |
| } |
|
675 |
80
| if (definition.getName() != null) {
|
|
676 |
80
| setLocationWithinModule(context + ".getName()");
|
|
677 |
80
| d.setName(definition.getName());
|
|
678 |
| } |
|
679 |
80
| if (definition.getVariableList() != null) {
|
|
680 |
65
| setLocationWithinModule(context + ".getVariableList()");
|
|
681 |
65
| d.setVariableList(create(definition.getVariableList()));
|
|
682 |
| } |
|
683 |
80
| if (definition.getTerm() != null) {
|
|
684 |
80
| setLocationWithinModule(context + ".getTerm()");
|
|
685 |
80
| d.setTerm(create(definition.getTerm()));
|
|
686 |
| } |
|
687 |
80
| if (definition.getDescription() != null) {
|
|
688 |
0
| setLocationWithinModule(context + ".getDescription()");
|
|
689 |
0
| d.setDescription(create(definition.getDescription()));
|
|
690 |
| } |
|
691 |
80
| setLocationWithinModule(context);
|
|
692 |
80
| return d;
|
|
693 |
| } |
|
694 |
| |
|
695 |
276
| private final PropositionVo create(final Proposition proposition) {
|
|
696 |
276
| if (proposition == null) {
|
|
697 |
0
| return null;
|
|
698 |
| } |
|
699 |
276
| final PropositionVo p = new PropositionVo();
|
|
700 |
276
| final String context = getCurrentContext().getLocationWithinModule();
|
|
701 |
276
| if (proposition.getFormula() != null) {
|
|
702 |
276
| setLocationWithinModule(context + ".getFormula()");
|
|
703 |
276
| p.setFormula(create(proposition.getFormula()));
|
|
704 |
| } |
|
705 |
276
| if (proposition.getDescription() != null) {
|
|
706 |
5
| setLocationWithinModule(context + ".getDescription()");
|
|
707 |
5
| p.setDescription(create(proposition.getDescription()));
|
|
708 |
| } |
|
709 |
276
| if (proposition.getProofList() != null) {
|
|
710 |
28
| setLocationWithinModule(context + ".getProofList()");
|
|
711 |
28
| p.setProofList(create(proposition.getProofList()));
|
|
712 |
| } |
|
713 |
276
| setLocationWithinModule(context);
|
|
714 |
276
| return p;
|
|
715 |
| } |
|
716 |
| |
|
717 |
26
| private final RuleVo create(final Rule rule) {
|
|
718 |
26
| if (rule == null) {
|
|
719 |
0
| return null;
|
|
720 |
| } |
|
721 |
26
| final RuleVo r = new RuleVo();
|
|
722 |
26
| final String context = getCurrentContext().getLocationWithinModule();
|
|
723 |
26
| if (rule.getName() != null) {
|
|
724 |
26
| setLocationWithinModule(context + ".getName()");
|
|
725 |
26
| r.setName(rule.getName());
|
|
726 |
| } |
|
727 |
26
| if (rule.getLinkList() != null) {
|
|
728 |
5
| setLocationWithinModule(context + ".getLinkList()");
|
|
729 |
5
| r.setLinkList(create(rule.getLinkList()));
|
|
730 |
| } |
|
731 |
26
| if (rule.getDescription() != null) {
|
|
732 |
26
| setLocationWithinModule(context + ".getDescription()");
|
|
733 |
26
| r.setDescription(create(rule.getDescription()));
|
|
734 |
| } |
|
735 |
26
| if (rule.getProofList() != null) {
|
|
736 |
0
| setLocationWithinModule(context + ".getProofList()");
|
|
737 |
0
| r.setProofList(create(rule.getProofList()));
|
|
738 |
| } |
|
739 |
26
| setLocationWithinModule(context);
|
|
740 |
26
| return r;
|
|
741 |
| } |
|
742 |
| |
|
743 |
5
| private final LinkListVo create(final LinkList linkList) {
|
|
744 |
5
| if (linkList == null) {
|
|
745 |
0
| return null;
|
|
746 |
| } |
|
747 |
5
| final LinkListVo list = new LinkListVo();
|
|
748 |
5
| final String context = getCurrentContext().getLocationWithinModule();
|
|
749 |
5
| for (int i = 0; i < linkList.size(); i++) {
|
|
750 |
5
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
751 |
5
| list.add(linkList.get(i));
|
|
752 |
| } |
|
753 |
5
| setLocationWithinModule(context);
|
|
754 |
5
| return list;
|
|
755 |
| } |
|
756 |
| |
|
757 |
129
| private final VariableListVo create(final VariableList variableList) {
|
|
758 |
129
| if (variableList == null) {
|
|
759 |
0
| return null;
|
|
760 |
| } |
|
761 |
129
| final VariableListVo list = new VariableListVo();
|
|
762 |
129
| final String context = getCurrentContext().getLocationWithinModule();
|
|
763 |
129
| for (int i = 0; i < variableList.size(); i++) {
|
|
764 |
188
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
765 |
188
| list.add(create(variableList.get(i)));
|
|
766 |
| } |
|
767 |
129
| setLocationWithinModule(context);
|
|
768 |
129
| return list;
|
|
769 |
| } |
|
770 |
| |
|
771 |
28
| private final ProofListVo create(final ProofList proofList) {
|
|
772 |
28
| if (proofList == null) {
|
|
773 |
0
| return null;
|
|
774 |
| } |
|
775 |
28
| final ProofListVo list = new ProofListVo();
|
|
776 |
28
| final String context = getCurrentContext().getLocationWithinModule();
|
|
777 |
28
| for (int i = 0; i < proofList.size(); i++) {
|
|
778 |
28
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
779 |
28
| list.add(create(proofList.get(i)));
|
|
780 |
| } |
|
781 |
28
| setLocationWithinModule(context);
|
|
782 |
28
| return list;
|
|
783 |
| } |
|
784 |
| |
|
785 |
28
| private final ProofVo create(final Proof proof) {
|
|
786 |
28
| if (proof == null) {
|
|
787 |
0
| return null;
|
|
788 |
| } |
|
789 |
28
| final ProofVo p = new ProofVo();
|
|
790 |
28
| final String context = getCurrentContext().getLocationWithinModule();
|
|
791 |
28
| setLocationWithinModule(context + ".getKind()");
|
|
792 |
28
| p.setKind(proof.getKind());
|
|
793 |
28
| setLocationWithinModule(context + ".getLevel()");
|
|
794 |
28
| p.setLevel(proof.getLevel());
|
|
795 |
28
| setLocationWithinModule(context);
|
|
796 |
28
| if (proof.getNonFormalProof() != null) {
|
|
797 |
28
| setLocationWithinModule(context + ".getNonFormalProof()");
|
|
798 |
28
| p.setNonFormalProof(create(proof.getNonFormalProof()));
|
|
799 |
| } |
|
800 |
28
| setLocationWithinModule(context);
|
|
801 |
28
| return p;
|
|
802 |
| } |
|
803 |
| |
|
804 |
418
| private final FormulaVo create(final Formula formula) {
|
|
805 |
418
| if (formula == null) {
|
|
806 |
0
| return null;
|
|
807 |
| } |
|
808 |
418
| final FormulaVo f = new FormulaVo();
|
|
809 |
418
| final String context = getCurrentContext().getLocationWithinModule();
|
|
810 |
418
| if (formula.getElement() != null) {
|
|
811 |
418
| setLocationWithinModule(context + ".getElement()");
|
|
812 |
418
| f.setElement(create(formula.getElement()));
|
|
813 |
| } |
|
814 |
418
| setLocationWithinModule(context);
|
|
815 |
418
| return f;
|
|
816 |
| } |
|
817 |
| |
|
818 |
80
| private final TermVo create(final Term term) {
|
|
819 |
80
| if (term == null) {
|
|
820 |
0
| return null;
|
|
821 |
| } |
|
822 |
80
| final TermVo f = new TermVo();
|
|
823 |
80
| final String context = getCurrentContext().getLocationWithinModule();
|
|
824 |
80
| if (term.getElement() != null) {
|
|
825 |
80
| setLocationWithinModule(context + ".getElement()");
|
|
826 |
80
| f.setElement(create(term.getElement()));
|
|
827 |
| } |
|
828 |
80
| setLocationWithinModule(context);
|
|
829 |
80
| return f;
|
|
830 |
| } |
|
831 |
| |
|
832 |
15496
| private final Element create(final Element element) {
|
|
833 |
15496
| if (element == null) {
|
|
834 |
0
| return null;
|
|
835 |
| } |
|
836 |
15496
| final Element e;
|
|
837 |
15496
| final String context = getCurrentContext().getLocationWithinModule();
|
|
838 |
15496
| if (element.isList()) {
|
|
839 |
8621
| setLocationWithinModule(context + ".getList()");
|
|
840 |
8621
| e = create(element.getList());
|
|
841 |
6875
| } else if (element.isAtom()) {
|
|
842 |
| |
|
843 |
6875
| return create(element.getAtom());
|
|
844 |
| } else { |
|
845 |
0
| throw new RuntimeException("unknown element type: " + element);
|
|
846 |
| } |
|
847 |
8621
| setLocationWithinModule(context);
|
|
848 |
8621
| return e;
|
|
849 |
| } |
|
850 |
| |
|
851 |
| |
|
852 |
8621
| private final DefaultElementList create(final ElementList list) {
|
|
853 |
8621
| if (list == null) {
|
|
854 |
0
| return null;
|
|
855 |
| } |
|
856 |
8621
| final DefaultElementList n = new DefaultElementList(list.getOperator(), new Element[] {});
|
|
857 |
8621
| final String context = getCurrentContext().getLocationWithinModule();
|
|
858 |
8621
| for (int i = 0; i < list.size(); i++) {
|
|
859 |
14810
| if (list.getElement(i).isList()) {
|
|
860 |
7935
| setLocationWithinModule(context + ".getElement(" + i + ")");
|
|
861 |
| } |
|
862 |
14810
| n.add(create(list.getElement(i)));
|
|
863 |
| } |
|
864 |
8621
| setLocationWithinModule(context);
|
|
865 |
8621
| return n;
|
|
866 |
| } |
|
867 |
| |
|
868 |
6875
| private final DefaultAtom create(final Atom atom) {
|
|
869 |
6875
| if (atom == null) {
|
|
870 |
0
| return null;
|
|
871 |
| } |
|
872 |
6875
| final String context = getCurrentContext().getLocationWithinModule();
|
|
873 |
6875
| return new DefaultAtom(atom.getString());
|
|
874 |
| } |
|
875 |
| |
|
876 |
2099
| private final LatexListVo create(final LatexList latexList) {
|
|
877 |
2099
| if (latexList == null) {
|
|
878 |
0
| return null;
|
|
879 |
| } |
|
880 |
2099
| final LatexListVo list = new LatexListVo();
|
|
881 |
2099
| final String context = getCurrentContext().getLocationWithinModule();
|
|
882 |
2099
| for (int i = 0; i < latexList.size(); i++) {
|
|
883 |
3759
| setLocationWithinModule(context + ".get(" + i + ")");
|
|
884 |
3759
| list.add(create(latexList.get(i)));
|
|
885 |
| } |
|
886 |
2099
| setLocationWithinModule(context);
|
|
887 |
2099
| return list;
|
|
888 |
| } |
|
889 |
| |
|
890 |
| |
|
891 |
| |
|
892 |
| |
|
893 |
| |
|
894 |
| |
|
895 |
| |
|
896 |
3788
| private final LatexVo create(final Latex latex) {
|
|
897 |
3788
| if (latex == null) {
|
|
898 |
0
| return null;
|
|
899 |
| } |
|
900 |
3788
| final LatexVo lat = new LatexVo();
|
|
901 |
3788
| lat.setLanguage(latex.getLanguage());
|
|
902 |
3788
| lat.setLatex(latex.getLatex());
|
|
903 |
3788
| return lat;
|
|
904 |
| } |
|
905 |
| |
|
906 |
| |
|
907 |
| |
|
908 |
| |
|
909 |
| |
|
910 |
| |
|
911 |
28803
| protected void setLocationWithinModule(final String locationWithinModule) {
|
|
912 |
28803
| getCurrentContext().setLocationWithinModule(locationWithinModule);
|
|
913 |
| } |
|
914 |
| |
|
915 |
| |
|
916 |
| |
|
917 |
| |
|
918 |
| |
|
919 |
| |
|
920 |
172638
| protected final ModuleContext getCurrentContext() {
|
|
921 |
172638
| return currentContext;
|
|
922 |
| } |
|
923 |
| |
|
924 |
| |
|
925 |
| |
|
926 |
| |
|
927 |
| |
|
928 |
| |
|
929 |
42930
| protected final Qedeq getQedeqOriginal() {
|
|
930 |
42930
| return original;
|
|
931 |
| } |
|
932 |
| |
|
933 |
| |
|
934 |
| |
|
935 |
| |
|
936 |
| |
|
937 |
| |
|
938 |
539
| protected final QedeqBo getQedeqCreated() {
|
|
939 |
539
| return qedeq;
|
|
940 |
| } |
|
941 |
| |
|
942 |
| } |