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