Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart8.png 62% of files have more coverage
674   1,234   222   13.48
344   1,064   0.33   50
50     4.44  
1    
 
  QedeqVoBuilder       Line # 141 674 222 77.7% 0.77715355
 
  (93)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.bo.service.control;
17   
18    import org.qedeq.kernel.se.base.list.Atom;
19    import org.qedeq.kernel.se.base.list.Element;
20    import org.qedeq.kernel.se.base.list.ElementList;
21    import org.qedeq.kernel.se.base.module.Add;
22    import org.qedeq.kernel.se.base.module.Author;
23    import org.qedeq.kernel.se.base.module.AuthorList;
24    import org.qedeq.kernel.se.base.module.Axiom;
25    import org.qedeq.kernel.se.base.module.ChangedRule;
26    import org.qedeq.kernel.se.base.module.ChangedRuleList;
27    import org.qedeq.kernel.se.base.module.Chapter;
28    import org.qedeq.kernel.se.base.module.ChapterList;
29    import org.qedeq.kernel.se.base.module.Conclusion;
30    import org.qedeq.kernel.se.base.module.ConditionalProof;
31    import org.qedeq.kernel.se.base.module.Existential;
32    import org.qedeq.kernel.se.base.module.FormalProof;
33    import org.qedeq.kernel.se.base.module.FormalProofLine;
34    import org.qedeq.kernel.se.base.module.FormalProofLineList;
35    import org.qedeq.kernel.se.base.module.FormalProofList;
36    import org.qedeq.kernel.se.base.module.Formula;
37    import org.qedeq.kernel.se.base.module.FunctionDefinition;
38    import org.qedeq.kernel.se.base.module.Header;
39    import org.qedeq.kernel.se.base.module.Hypothesis;
40    import org.qedeq.kernel.se.base.module.Import;
41    import org.qedeq.kernel.se.base.module.ImportList;
42    import org.qedeq.kernel.se.base.module.InitialFunctionDefinition;
43    import org.qedeq.kernel.se.base.module.InitialPredicateDefinition;
44    import org.qedeq.kernel.se.base.module.Latex;
45    import org.qedeq.kernel.se.base.module.LatexList;
46    import org.qedeq.kernel.se.base.module.LinkList;
47    import org.qedeq.kernel.se.base.module.LiteratureItem;
48    import org.qedeq.kernel.se.base.module.LiteratureItemList;
49    import org.qedeq.kernel.se.base.module.Location;
50    import org.qedeq.kernel.se.base.module.LocationList;
51    import org.qedeq.kernel.se.base.module.ModusPonens;
52    import org.qedeq.kernel.se.base.module.Node;
53    import org.qedeq.kernel.se.base.module.PredicateDefinition;
54    import org.qedeq.kernel.se.base.module.Proof;
55    import org.qedeq.kernel.se.base.module.ProofList;
56    import org.qedeq.kernel.se.base.module.Proposition;
57    import org.qedeq.kernel.se.base.module.Qedeq;
58    import org.qedeq.kernel.se.base.module.Reason;
59    import org.qedeq.kernel.se.base.module.Rename;
60    import org.qedeq.kernel.se.base.module.Rule;
61    import org.qedeq.kernel.se.base.module.Section;
62    import org.qedeq.kernel.se.base.module.SectionList;
63    import org.qedeq.kernel.se.base.module.Specification;
64    import org.qedeq.kernel.se.base.module.Subsection;
65    import org.qedeq.kernel.se.base.module.SubsectionList;
66    import org.qedeq.kernel.se.base.module.SubstFree;
67    import org.qedeq.kernel.se.base.module.SubstFunc;
68    import org.qedeq.kernel.se.base.module.SubstPred;
69    import org.qedeq.kernel.se.base.module.Universal;
70    import org.qedeq.kernel.se.base.module.UsedByList;
71    import org.qedeq.kernel.se.common.IllegalModuleDataException;
72    import org.qedeq.kernel.se.common.ModuleAddress;
73    import org.qedeq.kernel.se.common.ModuleContext;
74    import org.qedeq.kernel.se.common.ModuleDataException;
75    import org.qedeq.kernel.se.dto.list.DefaultAtom;
76    import org.qedeq.kernel.se.dto.list.DefaultElementList;
77    import org.qedeq.kernel.se.dto.module.AddVo;
78    import org.qedeq.kernel.se.dto.module.AuthorListVo;
79    import org.qedeq.kernel.se.dto.module.AuthorVo;
80    import org.qedeq.kernel.se.dto.module.AxiomVo;
81    import org.qedeq.kernel.se.dto.module.ChangedRuleListVo;
82    import org.qedeq.kernel.se.dto.module.ChangedRuleVo;
83    import org.qedeq.kernel.se.dto.module.ChapterListVo;
84    import org.qedeq.kernel.se.dto.module.ChapterVo;
85    import org.qedeq.kernel.se.dto.module.ConclusionVo;
86    import org.qedeq.kernel.se.dto.module.ConditionalProofVo;
87    import org.qedeq.kernel.se.dto.module.ExistentialVo;
88    import org.qedeq.kernel.se.dto.module.FormalProofLineListVo;
89    import org.qedeq.kernel.se.dto.module.FormalProofLineVo;
90    import org.qedeq.kernel.se.dto.module.FormalProofListVo;
91    import org.qedeq.kernel.se.dto.module.FormalProofVo;
92    import org.qedeq.kernel.se.dto.module.FormulaVo;
93    import org.qedeq.kernel.se.dto.module.FunctionDefinitionVo;
94    import org.qedeq.kernel.se.dto.module.HeaderVo;
95    import org.qedeq.kernel.se.dto.module.HypothesisVo;
96    import org.qedeq.kernel.se.dto.module.ImportListVo;
97    import org.qedeq.kernel.se.dto.module.ImportVo;
98    import org.qedeq.kernel.se.dto.module.InitialFunctionDefinitionVo;
99    import org.qedeq.kernel.se.dto.module.InitialPredicateDefinitionVo;
100    import org.qedeq.kernel.se.dto.module.LatexListVo;
101    import org.qedeq.kernel.se.dto.module.LatexVo;
102    import org.qedeq.kernel.se.dto.module.LinkListVo;
103    import org.qedeq.kernel.se.dto.module.LiteratureItemListVo;
104    import org.qedeq.kernel.se.dto.module.LiteratureItemVo;
105    import org.qedeq.kernel.se.dto.module.LocationListVo;
106    import org.qedeq.kernel.se.dto.module.LocationVo;
107    import org.qedeq.kernel.se.dto.module.ModusPonensVo;
108    import org.qedeq.kernel.se.dto.module.NodeVo;
109    import org.qedeq.kernel.se.dto.module.PredicateDefinitionVo;
110    import org.qedeq.kernel.se.dto.module.ProofListVo;
111    import org.qedeq.kernel.se.dto.module.ProofVo;
112    import org.qedeq.kernel.se.dto.module.PropositionVo;
113    import org.qedeq.kernel.se.dto.module.QedeqVo;
114    import org.qedeq.kernel.se.dto.module.RenameVo;
115    import org.qedeq.kernel.se.dto.module.RuleVo;
116    import org.qedeq.kernel.se.dto.module.SectionListVo;
117    import org.qedeq.kernel.se.dto.module.SectionVo;
118    import org.qedeq.kernel.se.dto.module.SpecificationVo;
119    import org.qedeq.kernel.se.dto.module.SubsectionListVo;
120    import org.qedeq.kernel.se.dto.module.SubsectionVo;
121    import org.qedeq.kernel.se.dto.module.SubstFreeVo;
122    import org.qedeq.kernel.se.dto.module.SubstFuncVo;
123    import org.qedeq.kernel.se.dto.module.SubstPredVo;
124    import org.qedeq.kernel.se.dto.module.UniversalVo;
125    import org.qedeq.kernel.se.dto.module.UsedByListVo;
126   
127   
128    /**
129    * TODO 20110125 m31: why do we need this builder? To make copies. Why don't we take the original?
130    * At least use director pattern or transfer creation methods into BOs or use visitor pattern!
131    * We have lots of duplicate code here!
132    * <p>
133    * An builder for creating {@link org.qedeq.kernel.se.dto.module.QedeqVo}s. This builder takes
134    * something that implements the QEDEQ interfaces (beginning with
135    * (@link org.qedeq.kernel.base.module.Qedeq} and makes copies that are out of the package
136    * <code>org.qedeq.kernel.dto.*</code>. Only elements that are not <code>null</code> are
137    * copied.
138   
139    * @author Michael Meyling
140    */
 
141    public class QedeqVoBuilder {
142   
143    /** QEDEQ module input object. */
144    private Qedeq original;
145   
146    /** Current context during creation. */
147    private ModuleContext currentContext;
148   
149    /**
150    * Constructor.
151    *
152    * @param address QEDEQ address.
153    */
 
154  582 toggle protected QedeqVoBuilder(final ModuleAddress address) {
155  582 this.currentContext = address.createModuleContext();
156    }
157   
158    /**
159    * Create {@link QedeqVo} out of an {@link Qedeq} instance.
160    * The resulting object has no references to the original {@link Qedeq} instance.
161    * <p>
162    * During the creation process the caller must assert that no modifications are made
163    * to the {@link Qedeq} instance including its referenced objects.
164    *
165    * @param address Module address.
166    * @param original Basic QEDEQ module object.
167    * @return Created copy object.
168    * @throws ModuleDataException Invalid data found.
169    */
 
170  565 toggle public static QedeqVo createQedeq(final ModuleAddress address,
171    final Qedeq original) throws ModuleDataException {
172  565 final QedeqVoBuilder creator = new QedeqVoBuilder(address);
173  565 QedeqVo vo = creator.create(original);
174  565 return vo;
175    }
176   
177    /**
178    * Create {@linkQedeqVo} out of an {@link Qedeq} instance.
179    * During that procedure some basic checking is done. E.g. the uniqueness of entries
180    * is tested. The resulting business object has no references to the original
181    * {@link Qedeq} instance.
182    *
183    * <p>
184    * During the creation process the caller must assert that no modifications are made
185    * to the {@link Qedeq} instance including its referenced objects.
186    *
187    * @param original Basic QEDEQ module object.
188    * @return Copied QEDEQ object.
189    * @throws IllegalModuleDataException Basic semantic error occurred.
190    */
 
191  582 toggle protected final QedeqVo create(final Qedeq original) throws IllegalModuleDataException {
192  582 this.original = original;
193  582 getCurrentContext().setLocationWithinModule("");
194  582 QedeqVo qedeq;
195  582 if (original == null) {
196  0 qedeq = null;
197  0 return qedeq;
198    }
199  582 qedeq = new QedeqVo();
200  582 final String context = getCurrentContext().getLocationWithinModule();
201  582 if (original.getHeader() != null) {
202  582 getCurrentContext().setLocationWithinModule(context + "getHeader()");
203  582 qedeq.setHeader(create(original.getHeader()));
204    }
205  582 if (original.getChapterList() != null) {
206  582 getCurrentContext().setLocationWithinModule(context + "getChapterList()");
207  582 qedeq.setChapterList(create(original.getChapterList()));
208    }
209  582 if (original.getLiteratureItemList() != null) {
210  252 getCurrentContext().setLocationWithinModule(context + "getLiteratureItemList()");
211  252 qedeq.setLiteratureItemList(create(original.getLiteratureItemList()));
212    }
213  582 return qedeq;
214    }
215   
216    /**
217    * Create {@link HeaderVo} out of an {@link Header} instance.
218    * During that procedure some basic checking is done. E.g. the uniqueness of entries
219    * is tested. The resulting business object has no references to the original
220    * {@link Header} instance.
221    * <p>
222    * During the creation process the caller must assert that no modifications are made
223    * to the {@link Header} instance including its referenced objects.
224    *
225    * @param header Basic header object.
226    * @return Filled header business object. Is equal to the parameter <code>header</code>.
227    * @throws IllegalModuleDataException Basic semantic error occurred.
228    */
 
229  582 toggle private final HeaderVo create(final Header header)
230    throws IllegalModuleDataException {
231  582 if (header == null) {
232  0 return null;
233    }
234  582 final HeaderVo h = new HeaderVo();
235  582 final String context = getCurrentContext().getLocationWithinModule();
236  582 if (header.getTitle() != null) {
237  582 setLocationWithinModule(context + ".getTitle()");
238  582 h.setTitle(create(header.getTitle()));
239    }
240  582 if (header.getAuthorList() != null) {
241  582 setLocationWithinModule(context + ".getAuthorList()");
242  582 h.setAuthorList(create(header.getAuthorList()));
243    }
244  582 if (header.getSummary() != null) {
245  582 setLocationWithinModule(context + ".getSummary()");
246  582 h.setSummary(create(header.getSummary()));
247    }
248  582 if (header.getEmail() != null) {
249  582 setLocationWithinModule(context + ".getEmail()");
250  582 h.setEmail(header.getEmail());
251    }
252  582 if (header.getSpecification() != null) {
253  582 setLocationWithinModule(context + ".getSpecification()");
254  582 h.setSpecification(create(header.getSpecification()));
255    }
256  582 if (header.getImportList() != null) {
257  357 setLocationWithinModule(context + ".getImportList()");
258  357 h.setImportList(create(header.getImportList()));
259    }
260  582 if (header.getUsedByList() != null) {
261  133 setLocationWithinModule(context + ".getUsedByList()");
262  133 h.setUsedByList(create(header.getUsedByList()));
263    }
264  582 setLocationWithinModule(context);
265  582 return h;
266    }
267   
268    /**
269    * Create {@link UsedByListVo} out of an {@link UsedByList} instance.
270    * During that procedure some basic checking is done. E.g. the uniqueness of entries
271    * is tested. The resulting business object has no references to the original
272    * {@link UsedByList} instance.
273    * <p>
274    * During the creation process the caller must assert that no modifications are made
275    * to the {@link UsedByList} instance including its referenced objects.
276    *
277    * @param usedByList Basic header object.
278    * @return Filled used by business object. Is equal to the parameter <code>usedByList</code>.
279    */
 
280  133 toggle private final UsedByListVo create(final UsedByList usedByList) {
281  133 if (usedByList == null) {
282  0 return null;
283    }
284  133 final String context = getCurrentContext().getLocationWithinModule();
285  133 final UsedByListVo list = new UsedByListVo();
286  266 for (int i = 0; i < usedByList.size(); i++) {
287  133 setLocationWithinModule(context + ".get(" + i + ")");
288  133 list.add(create(usedByList.get(i)));
289    }
290  133 setLocationWithinModule(context);
291  133 return list;
292    }
293   
 
294  357 toggle private final ImportListVo create(final ImportList importList) {
295  357 if (importList == null) {
296  0 return null;
297    }
298  357 final String context = getCurrentContext().getLocationWithinModule();
299  357 final ImportListVo list = new ImportListVo();
300  830 for (int i = 0; i < importList.size(); i++) {
301  473 setLocationWithinModule(context + ".get(" + i + ")");
302  473 list.add(create(importList.get(i)));
303    }
304  357 setLocationWithinModule(context);
305  357 return list;
306    }
307   
 
308  473 toggle private final ImportVo create(final Import imp) {
309  473 if (imp == null) {
310  0 return null;
311    }
312  473 final ImportVo i = new ImportVo();
313  473 final String context = getCurrentContext().getLocationWithinModule();
314  473 if (imp.getLabel() != null) {
315  473 setLocationWithinModule(context + ".getLabel()");
316  473 i.setLabel(imp.getLabel());
317    }
318  473 if (imp.getSpecification() != null) {
319  473 setLocationWithinModule(context + ".getSpecification()");
320  473 i.setSpecification(create(imp.getSpecification()));
321    }
322  473 setLocationWithinModule(context);
323  473 return i;
324    }
325   
 
326  1188 toggle private final SpecificationVo create(final Specification specification) {
327  1188 if (specification == null) {
328  0 return null;
329    }
330  1188 final SpecificationVo s = new SpecificationVo();
331  1188 final String context = getCurrentContext().getLocationWithinModule();
332  1188 if (specification.getName() != null) {
333  1188 setLocationWithinModule(context + ".getName()");
334  1188 s.setName(specification.getName());
335    }
336  1188 if (specification.getRuleVersion() != null) {
337  1188 setLocationWithinModule(context + ".getRuleVersion()");
338  1188 s.setRuleVersion(specification.getRuleVersion());
339    }
340  1188 if (specification.getLocationList() != null) {
341  1188 setLocationWithinModule(context + ".getLocationList()");
342  1188 s.setLocationList(create(specification.getLocationList()));
343    }
344  1188 setLocationWithinModule(context);
345  1188 return s;
346    }
347   
 
348  1188 toggle private final LocationListVo create(final LocationList locationList) {
349  1188 if (locationList == null) {
350  0 return null;
351    }
352  1188 final LocationListVo list = new LocationListVo();
353  1188 final String context = getCurrentContext().getLocationWithinModule();
354  2674 for (int i = 0; i < locationList.size(); i++) {
355  1486 setLocationWithinModule(context + ".get(" + i + ")");
356  1486 list.add(create(locationList.get(i)));
357    }
358  1188 setLocationWithinModule(context);
359  1188 return list;
360    }
361   
 
362  1486 toggle private final LocationVo create(final Location location) {
363  1486 if (location == null) {
364  0 return null;
365    }
366  1486 final LocationVo loc = new LocationVo();
367  1486 final String context = getCurrentContext().getLocationWithinModule();
368  1486 if (location.getLocation() != null) {
369  1486 setLocationWithinModule(context + ".getLocation()");
370  1486 loc.setLocation(location.getLocation());
371    }
372  1486 setLocationWithinModule(context);
373  1486 return loc;
374    }
375   
 
376  582 toggle private final AuthorListVo create(final AuthorList authorList) {
377  582 if (authorList == null) {
378  0 return null;
379    }
380  582 final AuthorListVo list = new AuthorListVo();
381  582 final String context = getCurrentContext().getLocationWithinModule();
382  1164 for (int i = 0; i < authorList.size(); i++) {
383  582 setLocationWithinModule(context + ".get(" + i + ")");
384  582 list.add(create(authorList.get(i)));
385    }
386  582 setLocationWithinModule(context);
387  582 return list;
388    }
389   
 
390  582 toggle private final AuthorVo create(final Author author) {
391  582 if (author == null) {
392  0 return null;
393    }
394  582 final AuthorVo a = new AuthorVo();
395  582 final String context = getCurrentContext().getLocationWithinModule();
396  582 if (author.getName() != null) {
397  582 setLocationWithinModule(context + ".getName()");
398  582 a.setName(create(author.getName()));
399    }
400  582 if (author.getEmail() != null) {
401  582 setLocationWithinModule(context + ".getEmail()");
402  582 a.setEmail(author.getEmail());
403    }
404  582 setLocationWithinModule(context);
405  582 return a;
406    }
407   
 
408  582 toggle private final ChapterListVo create(final ChapterList chapterList)
409    throws IllegalModuleDataException {
410  582 if (chapterList == null) {
411  0 return null;
412    }
413  582 final ChapterListVo list = new ChapterListVo();
414  582 final String context = getCurrentContext().getLocationWithinModule();
415  2899 for (int i = 0; i < chapterList.size(); i++) {
416  2317 setLocationWithinModule(context + ".get(" + i + ")");
417  2317 list.add(create(chapterList.get(i)));
418    }
419  582 setLocationWithinModule(context);
420  582 return list;
421    }
422   
 
423  2317 toggle private final ChapterVo create(final Chapter chapter)
424    throws IllegalModuleDataException {
425  2317 if (chapter == null) {
426  0 return null;
427    }
428  2317 final ChapterVo c = new ChapterVo();
429  2317 final String context = getCurrentContext().getLocationWithinModule();
430  2317 if (chapter.getTitle() != null) {
431  2317 setLocationWithinModule(context + ".getTitle()");
432  2317 c.setTitle(create(chapter.getTitle()));
433    }
434  2317 if (chapter.getNoNumber() != null) {
435  620 setLocationWithinModule(context + ".getNoNumber()");
436  620 c.setNoNumber(chapter.getNoNumber());
437    }
438  2317 if (chapter.getIntroduction() != null) {
439  2179 setLocationWithinModule(context + ".getIntroduction()");
440  2179 c.setIntroduction(create(chapter.getIntroduction()));
441    }
442  2317 if (chapter.getSectionList() != null) {
443  1424 setLocationWithinModule(context + ".getSectionList()");
444  1424 c.setSectionList(create(chapter.getSectionList()));
445    }
446  2317 setLocationWithinModule(context);
447  2317 return c;
448    }
449   
 
450  252 toggle private LiteratureItemListVo create(final LiteratureItemList literatureItemList) {
451  252 if (literatureItemList == null) {
452  0 return null;
453    }
454  252 final LiteratureItemListVo list = new LiteratureItemListVo();
455  252 final String context = getCurrentContext().getLocationWithinModule();
456  1307 for (int i = 0; i < literatureItemList.size(); i++) {
457  1055 setLocationWithinModule(context + ".get(" + i + ")");
458  1055 list.add(create(literatureItemList.get(i)));
459    }
460  252 setLocationWithinModule(context);
461  252 return list;
462    }
463   
 
464  1055 toggle private LiteratureItemVo create(final LiteratureItem item) {
465  1055 if (item == null) {
466  0 return null;
467    }
468  1055 final LiteratureItemVo it = new LiteratureItemVo();
469  1055 final String context = getCurrentContext().getLocationWithinModule();
470  1055 if (item.getLabel() != null) {
471  1055 setLocationWithinModule(context + ".getLabel()");
472  1055 it.setLabel(item.getLabel());
473    }
474  1055 if (item.getItem() != null) {
475  1055 setLocationWithinModule(context + ".getItem()");
476  1055 it.setItem(create(item.getItem()));
477    }
478  1055 setLocationWithinModule(context);
479  1055 return it;
480   
481    }
482   
 
483  1424 toggle private final SectionListVo create(final SectionList sectionList)
484    throws IllegalModuleDataException {
485  1424 if (sectionList == null) {
486  0 return null;
487    }
488  1424 final SectionListVo list = new SectionListVo();
489  1424 final String context = getCurrentContext().getLocationWithinModule();
490  6186 for (int i = 0; i < sectionList.size(); i++) {
491  4762 setLocationWithinModule(context + ".get(" + i + ")");
492  4762 list.add(create(sectionList.get(i)));
493    }
494  1424 setLocationWithinModule(context);
495  1424 return list;
496    }
497   
 
498  4762 toggle private final SectionVo create(final Section section)
499    throws IllegalModuleDataException {
500  4762 if (section == null) {
501  0 return null;
502    }
503  4762 final SectionVo s = new SectionVo();
504  4762 final String context = getCurrentContext().getLocationWithinModule();
505  4762 if (section.getTitle() != null) {
506  4762 setLocationWithinModule(context + ".getTitle()");
507  4762 s.setTitle(create(section.getTitle()));
508    }
509  4762 if (section.getNoNumber() != null) {
510  0 setLocationWithinModule(context + ".getNoNumber()");
511  0 s.setNoNumber(section.getNoNumber());
512    }
513  4762 if (section.getIntroduction() != null) {
514  4752 setLocationWithinModule(context + ".getIntroduction()");
515  4752 s.setIntroduction(create(section.getIntroduction()));
516    }
517  4762 if (section.getSubsectionList() != null) {
518  3124 setLocationWithinModule(context + ".getSubsectionList()");
519  3124 s.setSubsectionList(create(section.getSubsectionList()));
520    }
521  4762 setLocationWithinModule(context);
522  4762 return s;
523    }
524   
 
525  3124 toggle private final SubsectionListVo create(final SubsectionList subsectionList)
526    throws IllegalModuleDataException {
527  3124 if (subsectionList == null) {
528  0 return null;
529    }
530  3124 final SubsectionListVo list = new SubsectionListVo();
531  3124 final String context = getCurrentContext().getLocationWithinModule();
532  23190 for (int i = 0; i < subsectionList.size(); i++) {
533    // FIXME 20130201 m31: removed, because we can't find the location if we don't also specify the
534    // subsection type here, but is this handling ok?
535    // setLocationWithinModule(context + ".get(" + i + ")");
536    // TODO mime 20050608: here the Subsection context is type dependently specified
537  20066 if (subsectionList.get(i).getSubsection() != null) {
538  1104 setLocationWithinModule(context + ".get(" + i + ").getSubsection()");
539  1104 list.add(create(subsectionList.get(i).getSubsection()));
540  18962 } else if (subsectionList.get(i).getNode() != null) {
541  18962 setLocationWithinModule(context + ".get(" + i + ").getNode()");
542  18962 list.add(create(subsectionList.get(i).getNode()));
543    } else {
544  0 throw new IllegalArgumentException("unexpected subsection type: "
545    + subsectionList.get(i).getClass());
546    }
547    }
548  3124 setLocationWithinModule(context);
549  3124 return list;
550    }
551   
 
552  1104 toggle private final SubsectionVo create(final Subsection subsection) {
553  1104 if (subsection == null) {
554  0 return null;
555    }
556  1104 final SubsectionVo s = new SubsectionVo();
557  1104 final String context = getCurrentContext().getLocationWithinModule();
558  1104 if (subsection.getId() != null) {
559  10 setLocationWithinModule(context + ".getId()");
560  10 s.setId(subsection.getId());
561    }
562  1104 if (subsection.getLevel() != null) {
563  0 setLocationWithinModule(context + ".getLevel()");
564  0 s.setLevel(subsection.getLevel());
565    }
566  1104 if (subsection.getTitle() != null) {
567  234 setLocationWithinModule(context + ".getTitle()");
568  234 s.setTitle(create(subsection.getTitle()));
569    }
570  1104 if (subsection.getLatex() != null) {
571  1104 setLocationWithinModule(context + ".getLatex()");
572  1104 s.setLatex(create(subsection.getLatex()));
573    }
574  1104 setLocationWithinModule(context);
575  1104 return s;
576    }
577   
 
578  18962 toggle private final NodeVo create(final Node node)
579    throws IllegalModuleDataException {
580  18962 if (node == null) {
581  0 return null;
582    }
583  18962 final NodeVo n = new NodeVo();
584  18962 final String context = getCurrentContext().getLocationWithinModule();
585  18962 if (node.getName() != null) {
586  9507 setLocationWithinModule(context + ".getName()");
587  9507 n.setName(create(node.getName()));
588    }
589  18962 if (node.getId() != null) {
590  18962 setLocationWithinModule(context + ".getId()");
591  18962 n.setId(node.getId());
592    }
593  18962 if (node.getLevel() != null) {
594  12200 setLocationWithinModule(context + ".getLevel()");
595  12200 n.setLevel(node.getLevel());
596    }
597  18962 if (node.getTitle() != null) {
598  9503 setLocationWithinModule(context + ".getTitle()");
599  9503 n.setTitle(create(node.getTitle()));
600    }
601  18962 if (node.getPrecedingText() != null) {
602  16125 setLocationWithinModule(context + ".getPrecedingText()");
603  16125 n.setPrecedingText(create(node.getPrecedingText()));
604    }
605  18962 if (node.getNodeType() != null) {
606  18962 setLocationWithinModule(context + ".getNodeType()");
607  18962 if (node.getNodeType() instanceof Axiom) {
608  3441 setLocationWithinModule(context + ".getNodeType().getAxiom()");
609  3441 n.setNodeType(create((Axiom) node.getNodeType()));
610  15521 } else if (node.getNodeType() instanceof InitialPredicateDefinition) {
611  357 setLocationWithinModule(context + ".getNodeType().getInitialPredicateDefinition()");
612  357 n.setNodeType(create((InitialPredicateDefinition) node.getNodeType()));
613  15164 } else if (node.getNodeType() instanceof PredicateDefinition) {
614  1266 setLocationWithinModule(context + ".getNodeType().getPredicateDefinition()");
615  1266 n.setNodeType(create((PredicateDefinition) node.getNodeType()));
616  13898 } else if (node.getNodeType() instanceof InitialFunctionDefinition) {
617  0 setLocationWithinModule(context + ".getNodeType().getInitialFunctionDefinition()");
618  0 n.setNodeType(create((InitialFunctionDefinition) node.getNodeType()));
619  13898 } else if (node.getNodeType() instanceof FunctionDefinition) {
620  2570 setLocationWithinModule(context + ".getNodeType().getFunctionDefinition()");
621  2570 n.setNodeType(create((FunctionDefinition) node.getNodeType()));
622  11328 } else if (node.getNodeType() instanceof Proposition) {
623  9601 setLocationWithinModule(context + ".getNodeType().getProposition()");
624  9601 n.setNodeType(create((Proposition) node.getNodeType()));
625  1727 } else if (node.getNodeType() instanceof Rule) {
626  1727 setLocationWithinModule(context + ".getNodeType().getRule()");
627  1727 n.setNodeType(create((Rule) node.getNodeType()));
628    } else {
629  0 throw new IllegalModuleDataException(ServiceErrors.RUNTIME_ERROR_CODE,
630    ServiceErrors.RUNTIME_ERROR_TEXT + " "
631    + "unexpected node type: " + node.getNodeType().getClass(),
632    getCurrentContext());
633    }
634    }
635  18962 if (node.getSucceedingText() != null) {
636  3734 setLocationWithinModule(context + ".getSucceedingText()");
637  3734 n.setSucceedingText(create(node.getSucceedingText()));
638    }
639  18962 setLocationWithinModule(context);
640  18962 return n;
641    }
642   
 
643  3441 toggle private final AxiomVo create(final Axiom axiom) {
644  3441 if (axiom == null) {
645  0 return null;
646    }
647  3441 final AxiomVo a = new AxiomVo();
648  3441 final String context = getCurrentContext().getLocationWithinModule();
649  3441 if (axiom.getDefinedOperator() != null) {
650  231 setLocationWithinModule(context + ".getDefinedOperator()");
651  231 a.setDefinedOperator(axiom.getDefinedOperator());
652    }
653  3441 if (axiom.getFormula() != null) {
654  3441 setLocationWithinModule(context + ".getFormula()");
655  3441 a.setFormula(create(axiom.getFormula()));
656    }
657  3441 if (axiom.getDescription() != null) {
658  0 setLocationWithinModule(context + ".getDescription()");
659  0 a.setDescription(create(axiom.getDescription()));
660    }
661  3441 setLocationWithinModule(context);
662  3441 return a;
663    }
664   
 
665  357 toggle private final InitialPredicateDefinitionVo create(final InitialPredicateDefinition definition) {
666  357 if (definition == null) {
667  0 return null;
668    }
669  357 final InitialPredicateDefinitionVo d = new InitialPredicateDefinitionVo();
670  357 final String context = getCurrentContext().getLocationWithinModule();
671  357 if (definition.getLatexPattern() != null) {
672  357 setLocationWithinModule(context + ".getLatexPattern()");
673  357 d.setLatexPattern(definition.getLatexPattern());
674    }
675  357 if (definition.getName() != null) {
676  357 setLocationWithinModule(context + ".getName()");
677  357 d.setName(definition.getName());
678    }
679  357 if (definition.getArgumentNumber() != null) {
680  357 setLocationWithinModule(context + ".getArgumentNumber()");
681  357 d.setArgumentNumber(definition.getArgumentNumber());
682    }
683  357 if (definition.getPredCon() != null) {
684  357 setLocationWithinModule(context + ".getPredCon()");
685  357 d.setPredCon(create(definition.getPredCon()));
686    }
687  357 if (definition.getDescription() != null) {
688  0 setLocationWithinModule(context + ".getDescription()");
689  0 d.setDescription(create(definition.getDescription()));
690    }
691  357 setLocationWithinModule(context);
692  357 return d;
693    }
694   
 
695  1266 toggle private final PredicateDefinitionVo create(final PredicateDefinition definition) {
696  1266 if (definition == null) {
697  0 return null;
698    }
699  1266 final PredicateDefinitionVo d = new PredicateDefinitionVo();
700  1266 final String context = getCurrentContext().getLocationWithinModule();
701  1266 if (definition.getLatexPattern() != null) {
702  1266 setLocationWithinModule(context + ".getLatexPattern()");
703  1266 d.setLatexPattern(definition.getLatexPattern());
704    }
705  1266 if (definition.getName() != null) {
706  1266 setLocationWithinModule(context + ".getName()");
707  1266 d.setName(definition.getName());
708    }
709  1266 if (definition.getArgumentNumber() != null) {
710  1266 setLocationWithinModule(context + ".getArgumentNumber()");
711  1266 d.setArgumentNumber(definition.getArgumentNumber());
712    }
713  1266 if (definition.getFormula() != null) {
714  1266 setLocationWithinModule(context + ".getFormula()");
715  1266 d.setFormula(create(definition.getFormula()));
716    }
717  1266 if (definition.getDescription() != null) {
718  0 setLocationWithinModule(context + ".getDescription()");
719  0 d.setDescription(create(definition.getDescription()));
720    }
721  1266 setLocationWithinModule(context);
722  1266 return d;
723    }
724   
 
725  0 toggle private final InitialFunctionDefinitionVo create(final InitialFunctionDefinition definition) {
726  0 if (definition == null) {
727  0 return null;
728    }
729  0 final InitialFunctionDefinitionVo d = new InitialFunctionDefinitionVo();
730  0 final String context = getCurrentContext().getLocationWithinModule();
731  0 if (definition.getLatexPattern() != null) {
732  0 setLocationWithinModule(context + ".getLatexPattern()");
733  0 d.setLatexPattern(definition.getLatexPattern());
734    }
735  0 if (definition.getArgumentNumber() != null) {
736  0 setLocationWithinModule(context + ".getArgumentNumber()");
737  0 d.setArgumentNumber(definition.getArgumentNumber());
738    }
739  0 if (definition.getName() != null) {
740  0 setLocationWithinModule(context + ".getName()");
741  0 d.setName(definition.getName());
742    }
743  0 if (definition.getFunCon() != null) {
744  0 setLocationWithinModule(context + ".getFunCon()");
745  0 d.setFunCon(create(definition.getFunCon()));
746    }
747  0 if (definition.getDescription() != null) {
748  0 setLocationWithinModule(context + ".getDescription()");
749  0 d.setDescription(create(definition.getDescription()));
750    }
751  0 setLocationWithinModule(context);
752  0 return d;
753    }
754   
 
755  2570 toggle private final FunctionDefinitionVo create(final FunctionDefinition definition) {
756  2570 if (definition == null) {
757  0 return null;
758    }
759  2570 final FunctionDefinitionVo d = new FunctionDefinitionVo();
760  2570 final String context = getCurrentContext().getLocationWithinModule();
761  2570 if (definition.getLatexPattern() != null) {
762  2570 setLocationWithinModule(context + ".getLatexPattern()");
763  2570 d.setLatexPattern(definition.getLatexPattern());
764    }
765  2570 if (definition.getArgumentNumber() != null) {
766  2570 setLocationWithinModule(context + ".getArgumentNumber()");
767  2570 d.setArgumentNumber(definition.getArgumentNumber());
768    }
769  2570 if (definition.getName() != null) {
770  2570 setLocationWithinModule(context + ".getName()");
771  2570 d.setName(definition.getName());
772    }
773  2570 if (definition.getFormula() != null) {
774  2570 setLocationWithinModule(context + ".getFormula()");
775  2570 d.setFormula(create(definition.getFormula()));
776    }
777  2570 if (definition.getDescription() != null) {
778  0 setLocationWithinModule(context + ".getDescription()");
779  0 d.setDescription(create(definition.getDescription()));
780    }
781  2570 setLocationWithinModule(context);
782  2570 return d;
783    }
784   
 
785  9601 toggle private final PropositionVo create(final Proposition proposition) {
786  9601 if (proposition == null) {
787  0 return null;
788    }
789  9601 final PropositionVo p = new PropositionVo();
790  9601 final String context = getCurrentContext().getLocationWithinModule();
791  9601 if (proposition.getFormula() != null) {
792  9601 setLocationWithinModule(context + ".getFormula()");
793  9601 p.setFormula(create(proposition.getFormula()));
794    }
795  9601 if (proposition.getDescription() != null) {
796  160 setLocationWithinModule(context + ".getDescription()");
797  160 p.setDescription(create(proposition.getDescription()));
798    }
799  9601 if (proposition.getProofList() != null) {
800  2756 setLocationWithinModule(context + ".getProofList()");
801  2756 p.setProofList(create(proposition.getProofList()));
802    }
803  9601 if (proposition.getFormalProofList() != null) {
804  541 setLocationWithinModule(context + ".getFormalProofList()");
805  541 p.setFormalProofList(create(proposition.getFormalProofList()));
806    }
807  9601 setLocationWithinModule(context);
808  9601 return p;
809    }
810   
 
811  1727 toggle private final RuleVo create(final Rule rule) {
812  1727 if (rule == null) {
813  0 return null;
814    }
815  1727 final RuleVo r = new RuleVo();
816  1727 final String context = getCurrentContext().getLocationWithinModule();
817  1727 if (rule.getName() != null) {
818  1727 setLocationWithinModule(context + ".getName()");
819  1727 r.setName(rule.getName());
820    }
821  1727 if (rule.getVersion() != null) {
822  1727 setLocationWithinModule(context + ".getVersion()");
823  1727 r.setVersion(rule.getVersion());
824    }
825  1727 if (rule.getLinkList() != null) {
826  195 setLocationWithinModule(context + ".getLinkList()");
827  195 r.setLinkList(create(rule.getLinkList()));
828    }
829  1727 if (rule.getDescription() != null) {
830  1727 setLocationWithinModule(context + ".getDescription()");
831  1727 r.setDescription(create(rule.getDescription()));
832    }
833  1727 if (rule.getChangedRuleList() != null) {
834  9 setLocationWithinModule(context + ".getChangedRuleList()");
835  9 r.setChangedRuleList(create(rule.getChangedRuleList()));
836    }
837  1727 if (rule.getProofList() != null) {
838  9 setLocationWithinModule(context + ".getProofList()");
839  9 r.setProofList(create(rule.getProofList()));
840    }
841  1727 setLocationWithinModule(context);
842  1727 return r;
843    }
844   
 
845  9 toggle private final ChangedRuleListVo create(final ChangedRuleList changedRuleList) {
846  9 if (changedRuleList == null) {
847  0 return null;
848    }
849  9 final ChangedRuleListVo list = new ChangedRuleListVo();
850  9 final String context = getCurrentContext().getLocationWithinModule();
851  81 for (int i = 0; i < changedRuleList.size(); i++) {
852  72 setLocationWithinModule(context + ".get(" + i + ")");
853  72 list.add(create(changedRuleList.get(i)));
854    }
855  9 setLocationWithinModule(context);
856  9 return list;
857    }
858   
 
859  72 toggle private final ChangedRuleVo create(final ChangedRule rule) {
860  72 if (rule == null) {
861  0 return null;
862    }
863  72 final ChangedRuleVo r = new ChangedRuleVo();
864  72 final String context = getCurrentContext().getLocationWithinModule();
865  72 if (rule.getName() != null) {
866  72 setLocationWithinModule(context + ".getName()");
867  72 r.setName(rule.getName());
868    }
869  72 if (rule.getVersion() != null) {
870  72 setLocationWithinModule(context + ".getVersion()");
871  72 r.setVersion(rule.getVersion());
872    }
873  72 if (rule.getDescription() != null) {
874  72 setLocationWithinModule(context + ".getDescription()");
875  72 r.setDescription(create(rule.getDescription()));
876    }
877  72 setLocationWithinModule(context);
878  72 return r;
879    }
880   
 
881  195 toggle private final LinkListVo create(final LinkList linkList) {
882  195 if (linkList == null) {
883  0 return null;
884    }
885  195 final LinkListVo list = new LinkListVo();
886  195 final String context = getCurrentContext().getLocationWithinModule();
887  399 for (int i = 0; i < linkList.size(); i++) {
888  204 setLocationWithinModule(context + ".get(" + i + ")");
889  204 list.add(linkList.get(i));
890    }
891  195 setLocationWithinModule(context);
892  195 return list;
893    }
894   
 
895  2765 toggle private final ProofListVo create(final ProofList proofList) {
896  2765 if (proofList == null) {
897  0 return null;
898    }
899  2765 final ProofListVo list = new ProofListVo();
900  2765 final String context = getCurrentContext().getLocationWithinModule();
901  5689 for (int i = 0; i < proofList.size(); i++) {
902  2924 setLocationWithinModule(context + ".get(" + i + ")");
903  2924 list.add(create(proofList.get(i)));
904    }
905  2765 setLocationWithinModule(context);
906  2765 return list;
907    }
908   
 
909  2924 toggle private final ProofVo create(final Proof proof) {
910  2924 if (proof == null) {
911  0 return null;
912    }
913  2924 final ProofVo p = new ProofVo();
914  2924 final String context = getCurrentContext().getLocationWithinModule();
915  2924 setLocationWithinModule(context + ".getKind()");
916  2924 p.setKind(proof.getKind());
917  2924 setLocationWithinModule(context + ".getLevel()");
918  2924 p.setLevel(proof.getLevel());
919  2924 setLocationWithinModule(context);
920  2924 if (proof.getNonFormalProof() != null) {
921  2924 setLocationWithinModule(context + ".getNonFormalProof()");
922  2924 p.setNonFormalProof(create(proof.getNonFormalProof()));
923    }
924  2924 setLocationWithinModule(context);
925  2924 return p;
926    }
927   
 
928  541 toggle private final FormalProofListVo create(final FormalProofList proofList) {
929  541 if (proofList == null) {
930  0 return null;
931    }
932  541 final FormalProofListVo list = new FormalProofListVo();
933  541 final String context = getCurrentContext().getLocationWithinModule();
934  1082 for (int i = 0; i < proofList.size(); i++) {
935  541 setLocationWithinModule(context + ".get(" + i + ")");
936  541 list.add(create(proofList.get(i)));
937    }
938  541 setLocationWithinModule(context);
939  541 return list;
940    }
941   
 
942  541 toggle private final FormalProofVo create(final FormalProof proof) {
943  541 if (proof == null) {
944  0 return null;
945    }
946  541 final FormalProofVo p = new FormalProofVo();
947  541 final String context = getCurrentContext().getLocationWithinModule();
948  541 setLocationWithinModule(context);
949  541 if (proof.getPrecedingText() != null) {
950  0 setLocationWithinModule(context + ".getPrecedingText()");
951  0 p.setPrecedingText(create(proof.getPrecedingText()));
952    }
953  541 if (proof.getFormalProofLineList() != null) {
954  541 setLocationWithinModule(context + ".getFormalProofLineList()");
955  541 p.setFormalProofLineList(create(proof.getFormalProofLineList()));
956    }
957  541 if (proof.getSucceedingText() != null) {
958  0 setLocationWithinModule(context + ".getSucceedingText()");
959  0 p.setSucceedingText(create(proof.getSucceedingText()));
960    }
961  541 setLocationWithinModule(context);
962  541 return p;
963    }
964   
 
965  991 toggle private final FormalProofLineListVo create(final FormalProofLineList proofList) {
966  991 if (proofList == null) {
967  0 return null;
968    }
969  991 final FormalProofLineListVo list = new FormalProofLineListVo();
970  991 final String context = getCurrentContext().getLocationWithinModule();
971  6963 for (int i = 0; i < proofList.size(); i++) {
972  5972 setLocationWithinModule(context + ".get(" + i + ")");
973  5972 if (proofList.get(i) instanceof ConditionalProof) {
974  450 list.add(create((ConditionalProof) proofList.get(i)));
975    } else {
976  5522 list.add(create(proofList.get(i)));
977    }
978    }
979  991 setLocationWithinModule(context);
980  991 return list;
981    }
982   
 
983  5522 toggle private final FormalProofLineVo create(final FormalProofLine proofLine) {
984  5522 if (proofLine == null) {
985  0 return null;
986    }
987  5522 final FormalProofLineVo line = new FormalProofLineVo();
988  5522 final String context = getCurrentContext().getLocationWithinModule();
989  5522 if (proofLine.getLabel() != null) {
990  5511 setLocationWithinModule(context + ".getLabel()");
991  5511 line.setLabel(proofLine.getLabel());
992    }
993  5522 if (proofLine.getFormula() != null) {
994  5522 setLocationWithinModule(context + ".getFormula()");
995  5522 line.setFormula(create(proofLine.getFormula()));
996    }
997  5522 if (proofLine.getReason() != null) {
998  5522 setLocationWithinModule(context + ".getReason()");
999  5522 line.setReason(create(proofLine.getReason()));
1000    }
1001  5522 setLocationWithinModule(context);
1002  5522 return line;
1003    }
1004   
 
1005  450 toggle private final ConditionalProofVo create(final ConditionalProof proofLine) {
1006  450 if (proofLine == null) {
1007  0 return null;
1008    }
1009  450 final ConditionalProofVo line = new ConditionalProofVo();
1010  450 final String context = getCurrentContext().getLocationWithinModule();
1011  450 if (proofLine.getHypothesis() != null) {
1012  450 setLocationWithinModule(context + ".getHypothesis()");
1013  450 line.setHypothesis(proofLine.getHypothesis());
1014    }
1015  450 if (proofLine.getFormalProofLineList() != null) {
1016  450 setLocationWithinModule(context + ".getFormalProofLineList()");
1017  450 line.setFormalProofLineList(create(proofLine.getFormalProofLineList()));
1018    }
1019  450 if (proofLine.getConclusion() != null) {
1020  450 setLocationWithinModule(context + ".getConclusion()");
1021  450 line.setConclusion(create(proofLine.getConclusion()));
1022    }
1023  450 setLocationWithinModule(context);
1024  450 return line;
1025    }
1026   
 
1027  5522 toggle private final Reason create(final Reason reason) {
1028  5522 if (reason == null) {
1029  0 return null;
1030    }
1031  5522 final String context = getCurrentContext().getLocationWithinModule();
1032  5522 Reason result = null;
1033  5522 if (reason instanceof ModusPonens) {
1034  1468 setLocationWithinModule(context + ".getModusPonens()");
1035  1468 final ModusPonens r = (ModusPonens) reason;
1036  1468 result = new ModusPonensVo(r.getReference1(), r.getReference2());
1037  4054 } else if (reason instanceof Add) {
1038  1243 setLocationWithinModule(context + ".getAdd()");
1039  1243 final Add r = (Add) reason;
1040  1243 result = new AddVo(r.getReference());
1041  2811 } else if (reason instanceof Rename) {
1042  314 setLocationWithinModule(context + ".getRename()");
1043  314 final Rename r = (Rename) reason;
1044  314 result = new RenameVo(r.getReference(), r.getOriginalSubjectVariable(),
1045    r.getReplacementSubjectVariable(), r.getOccurrence());
1046  2497 } else if (reason instanceof SubstFree) {
1047  185 setLocationWithinModule(context + ".getSubstFree()");
1048  185 final SubstFree r = (SubstFree) reason;
1049  185 result = new SubstFreeVo(r.getReference(), r.getSubjectVariable(),
1050    r.getSubstituteTerm());
1051  2312 } else if (reason instanceof SubstFunc) {
1052  55 setLocationWithinModule(context + ".getSubstFunc()");
1053  55 final SubstFunc r = (SubstFunc) reason;
1054  55 result = new SubstFuncVo(r.getReference(), r.getFunctionVariable(),
1055    r.getSubstituteTerm());
1056  2257 } else if (reason instanceof SubstPred) {
1057  2072 setLocationWithinModule(context + ".getSubstPred()");
1058  2072 final SubstPred r = (SubstPred) reason;
1059  2072 result = new SubstPredVo(r.getReference(), r.getPredicateVariable(),
1060    r.getSubstituteFormula());
1061  185 } else if (reason instanceof Existential) {
1062  37 setLocationWithinModule(context + ".getExistential()");
1063  37 final Existential r = (Existential) reason;
1064  37 result = new ExistentialVo(r.getReference(), r.getSubjectVariable());
1065  148 } else if (reason instanceof Universal) {
1066  148 setLocationWithinModule(context + ".getUniversal()");
1067  148 final Universal r = (Universal) reason;
1068  148 result = new UniversalVo(r.getReference(), r.getSubjectVariable());
1069  0 } else if (reason instanceof ConditionalProof) {
1070  0 setLocationWithinModule(context + ".getConditionalProof()");
1071  0 final ConditionalProof r = (ConditionalProof) reason;
1072  0 setLocationWithinModule(context + ".getConditionalProof().getHypothesis()");
1073  0 final Hypothesis h = create(r.getHypothesis());
1074  0 setLocationWithinModule(context + ".getConditionalProof().getFormalProofLineList()");
1075  0 final FormalProofLineList l = create(r.getFormalProofLineList());
1076  0 setLocationWithinModule(context + ".getConditionalProof().getConclusion()");
1077  0 final Conclusion c = create(r.getConclusion());
1078  0 result = new ConditionalProofVo(h, l, c);
1079    } else {
1080  0 throw new RuntimeException("unknown reason class: " + reason.getClass());
1081    }
1082  5522 setLocationWithinModule(context);
1083  5522 return result;
1084    }
1085   
 
1086  0 toggle private final HypothesisVo create(final Hypothesis hypothesis) {
1087  0 if (hypothesis == null) {
1088  0 return null;
1089    }
1090  0 final HypothesisVo h = new HypothesisVo();
1091  0 final String context = getCurrentContext().getLocationWithinModule();
1092  0 if (hypothesis.getLabel() != null) {
1093  0 h.setLabel(hypothesis.getLabel());
1094    }
1095  0 if (hypothesis.getFormula() != null) {
1096  0 setLocationWithinModule(context + ".getFormula()");
1097  0 h.setFormula(create(hypothesis.getFormula()));
1098    }
1099  0 setLocationWithinModule(context);
1100  0 return h;
1101    }
1102   
 
1103  450 toggle private final ConclusionVo create(final Conclusion conclusion) {
1104  450 if (conclusion == null) {
1105  0 return null;
1106    }
1107  450 final ConclusionVo c = new ConclusionVo();
1108  450 final String context = getCurrentContext().getLocationWithinModule();
1109  450 if (conclusion.getLabel() != null) {
1110  450 c.setLabel(conclusion.getLabel());
1111    }
1112  450 if (conclusion.getFormula() != null) {
1113  450 setLocationWithinModule(context + ".getFormula()");
1114  450 c.setFormula(create(conclusion.getFormula()));
1115    }
1116  450 setLocationWithinModule(context);
1117  450 return c;
1118    }
1119   
 
1120  22850 toggle private final FormulaVo create(final Formula formula) {
1121  22850 if (formula == null) {
1122  0 return null;
1123    }
1124  22850 final FormulaVo f = new FormulaVo();
1125  22850 final String context = getCurrentContext().getLocationWithinModule();
1126  22850 if (formula.getElement() != null) {
1127  22850 setLocationWithinModule(context + ".getElement()");
1128  22850 f.setElement(create(formula.getElement()));
1129    }
1130  22850 setLocationWithinModule(context);
1131  22850 return f;
1132    }
1133   
 
1134  643550 toggle private final Element create(final Element element) {
1135  643550 if (element == null) {
1136  0 return null;
1137    }
1138  643550 final Element e;
1139  643550 final String context = getCurrentContext().getLocationWithinModule();
1140  643550 if (element.isList()) {
1141  365960 setLocationWithinModule(context + ".getList()");
1142  365960 e = create(element.getList());
1143  277590 } else if (element.isAtom()) {
1144    // setLocationWithinModule(context + ".getAtom()");
1145  277590 return create(element.getAtom());
1146    } else {
1147  0 throw new RuntimeException("unknown element type: " + element);
1148    }
1149  365960 setLocationWithinModule(context);
1150  365960 return e;
1151    }
1152   
1153   
 
1154  365960 toggle private final DefaultElementList create(final ElementList list) {
1155  365960 if (list == null) {
1156  0 return null;
1157    }
1158  365960 final DefaultElementList n = new DefaultElementList(list.getOperator(), new Element[] {});
1159  365960 final String context = getCurrentContext().getLocationWithinModule();
1160  986303 for (int i = 0; i < list.size(); i++) {
1161  620343 if (list.getElement(i).isList()) {
1162  342753 setLocationWithinModule(context + ".getElement(" + i + ")");
1163    }
1164  620343 n.add(create(list.getElement(i)));
1165    }
1166  365960 setLocationWithinModule(context);
1167  365960 return n;
1168    }
1169   
 
1170  277590 toggle private final DefaultAtom create(final Atom atom) {
1171  277590 if (atom == null) {
1172  0 return null;
1173    }
1174  277590 return new DefaultAtom(atom.getString());
1175    }
1176   
 
1177  61319 toggle private final LatexListVo create(final LatexList latexList) {
1178  61319 if (latexList == null) {
1179  0 return null;
1180    }
1181  61319 final LatexListVo list = new LatexListVo();
1182  61319 final String context = getCurrentContext().getLocationWithinModule();
1183  178136 for (int i = 0; i < latexList.size(); i++) {
1184  116817 setLocationWithinModule(context + ".get(" + i + ")");
1185  116817 list.add(create(latexList.get(i)));
1186    }
1187  61319 setLocationWithinModule(context);
1188  61319 return list;
1189    }
1190   
1191    /**
1192    * Creates LaTeX business object.
1193    *
1194    * @param latex LaTeX object.
1195    * @return LaTeX business object.
1196    */
 
1197  117399 toggle private final LatexVo create(final Latex latex) {
1198  117399 if (latex == null) {
1199  0 return null;
1200    }
1201  117399 final LatexVo lat = new LatexVo();
1202  117399 lat.setLanguage(latex.getLanguage());
1203  117399 lat.setLatex(latex.getLatex());
1204  117399 return lat;
1205    }
1206   
1207    /**
1208    * Set location information where are we within the original module.
1209    *
1210    * @param locationWithinModule Location within module.
1211    */
 
1212  1942541 toggle protected void setLocationWithinModule(final String locationWithinModule) {
1213  1942541 getCurrentContext().setLocationWithinModule(locationWithinModule);
1214    }
1215   
1216    /**
1217    * Get current context within original.
1218    *
1219    * @return Current context.
1220    */
 
1221  3352017 toggle protected final ModuleContext getCurrentContext() {
1222  3352017 return currentContext;
1223    }
1224   
1225    /**
1226    * Get original QEDEQ module.
1227    *
1228    * @return Original QEDEQ module.
1229    */
 
1230  117060 toggle protected final Qedeq getQedeqOriginal() {
1231  117060 return original;
1232    }
1233   
1234    }