Clover Coverage Report
Coverage timestamp: Fri Feb 14 2014 07:28:57 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 80.3% 0.8033708
 
  (108)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2014, 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.basis;
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  648 toggle protected QedeqVoBuilder(final ModuleAddress address) {
155  648 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  630 toggle public static QedeqVo createQedeq(final ModuleAddress address,
171    final Qedeq original) throws ModuleDataException {
172  630 final QedeqVoBuilder creator = new QedeqVoBuilder(address);
173  630 QedeqVo vo = creator.create(original);
174  630 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  648 toggle protected final QedeqVo create(final Qedeq original) throws IllegalModuleDataException {
192  648 this.original = original;
193  648 getCurrentContext().setLocationWithinModule("");
194  648 QedeqVo qedeq;
195  648 if (original == null) {
196  0 qedeq = null;
197  0 return qedeq;
198    }
199  648 qedeq = new QedeqVo();
200  648 final String context = getCurrentContext().getLocationWithinModule();
201  648 if (original.getHeader() != null) {
202  648 getCurrentContext().setLocationWithinModule(context + "getHeader()");
203  648 qedeq.setHeader(create(original.getHeader()));
204    }
205  648 if (original.getChapterList() != null) {
206  648 getCurrentContext().setLocationWithinModule(context + "getChapterList()");
207  648 qedeq.setChapterList(create(original.getChapterList()));
208    }
209  648 if (original.getLiteratureItemList() != null) {
210  266 getCurrentContext().setLocationWithinModule(context + "getLiteratureItemList()");
211  266 qedeq.setLiteratureItemList(create(original.getLiteratureItemList()));
212    }
213  648 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  648 toggle private final HeaderVo create(final Header header)
230    throws IllegalModuleDataException {
231  648 if (header == null) {
232  0 return null;
233    }
234  648 final HeaderVo h = new HeaderVo();
235  648 final String context = getCurrentContext().getLocationWithinModule();
236  648 if (header.getTitle() != null) {
237  648 setLocationWithinModule(context + ".getTitle()");
238  648 h.setTitle(create(header.getTitle()));
239    }
240  648 if (header.getAuthorList() != null) {
241  648 setLocationWithinModule(context + ".getAuthorList()");
242  648 h.setAuthorList(create(header.getAuthorList()));
243    }
244  648 if (header.getSummary() != null) {
245  648 setLocationWithinModule(context + ".getSummary()");
246  648 h.setSummary(create(header.getSummary()));
247    }
248  648 if (header.getEmail() != null) {
249  648 setLocationWithinModule(context + ".getEmail()");
250  648 h.setEmail(header.getEmail());
251    }
252  648 if (header.getSpecification() != null) {
253  648 setLocationWithinModule(context + ".getSpecification()");
254  648 h.setSpecification(create(header.getSpecification()));
255    }
256  648 if (header.getImportList() != null) {
257  396 setLocationWithinModule(context + ".getImportList()");
258  396 h.setImportList(create(header.getImportList()));
259    }
260  648 if (header.getUsedByList() != null) {
261  145 setLocationWithinModule(context + ".getUsedByList()");
262  145 h.setUsedByList(create(header.getUsedByList()));
263    }
264  648 setLocationWithinModule(context);
265  648 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  145 toggle private final UsedByListVo create(final UsedByList usedByList) {
281  145 if (usedByList == null) {
282  0 return null;
283    }
284  145 final String context = getCurrentContext().getLocationWithinModule();
285  145 final UsedByListVo list = new UsedByListVo();
286  290 for (int i = 0; i < usedByList.size(); i++) {
287  145 setLocationWithinModule(context + ".get(" + i + ")");
288  145 list.add(create(usedByList.get(i)));
289    }
290  145 setLocationWithinModule(context);
291  145 return list;
292    }
293   
 
294  396 toggle private final ImportListVo create(final ImportList importList) {
295  396 if (importList == null) {
296  0 return null;
297    }
298  396 final String context = getCurrentContext().getLocationWithinModule();
299  396 final ImportListVo list = new ImportListVo();
300  910 for (int i = 0; i < importList.size(); i++) {
301  514 setLocationWithinModule(context + ".get(" + i + ")");
302  514 list.add(create(importList.get(i)));
303    }
304  396 setLocationWithinModule(context);
305  396 return list;
306    }
307   
 
308  514 toggle private final ImportVo create(final Import imp) {
309  514 if (imp == null) {
310  0 return null;
311    }
312  514 final ImportVo i = new ImportVo();
313  514 final String context = getCurrentContext().getLocationWithinModule();
314  514 if (imp.getLabel() != null) {
315  514 setLocationWithinModule(context + ".getLabel()");
316  514 i.setLabel(imp.getLabel());
317    }
318  514 if (imp.getSpecification() != null) {
319  514 setLocationWithinModule(context + ".getSpecification()");
320  514 i.setSpecification(create(imp.getSpecification()));
321    }
322  514 setLocationWithinModule(context);
323  514 return i;
324    }
325   
 
326  1307 toggle private final SpecificationVo create(final Specification specification) {
327  1307 if (specification == null) {
328  0 return null;
329    }
330  1307 final SpecificationVo s = new SpecificationVo();
331  1307 final String context = getCurrentContext().getLocationWithinModule();
332  1307 if (specification.getName() != null) {
333  1307 setLocationWithinModule(context + ".getName()");
334  1307 s.setName(specification.getName());
335    }
336  1307 if (specification.getRuleVersion() != null) {
337  1307 setLocationWithinModule(context + ".getRuleVersion()");
338  1307 s.setRuleVersion(specification.getRuleVersion());
339    }
340  1307 if (specification.getLocationList() != null) {
341  1307 setLocationWithinModule(context + ".getLocationList()");
342  1307 s.setLocationList(create(specification.getLocationList()));
343    }
344  1307 setLocationWithinModule(context);
345  1307 return s;
346    }
347   
 
348  1307 toggle private final LocationListVo create(final LocationList locationList) {
349  1307 if (locationList == null) {
350  0 return null;
351    }
352  1307 final LocationListVo list = new LocationListVo();
353  1307 final String context = getCurrentContext().getLocationWithinModule();
354  2928 for (int i = 0; i < locationList.size(); i++) {
355  1621 setLocationWithinModule(context + ".get(" + i + ")");
356  1621 list.add(create(locationList.get(i)));
357    }
358  1307 setLocationWithinModule(context);
359  1307 return list;
360    }
361   
 
362  1621 toggle private final LocationVo create(final Location location) {
363  1621 if (location == null) {
364  0 return null;
365    }
366  1621 final LocationVo loc = new LocationVo();
367  1621 final String context = getCurrentContext().getLocationWithinModule();
368  1621 if (location.getLocation() != null) {
369  1621 setLocationWithinModule(context + ".getLocation()");
370  1621 loc.setLocation(location.getLocation());
371    }
372  1621 setLocationWithinModule(context);
373  1621 return loc;
374    }
375   
 
376  648 toggle private final AuthorListVo create(final AuthorList authorList) {
377  648 if (authorList == null) {
378  0 return null;
379    }
380  648 final AuthorListVo list = new AuthorListVo();
381  648 final String context = getCurrentContext().getLocationWithinModule();
382  1296 for (int i = 0; i < authorList.size(); i++) {
383  648 setLocationWithinModule(context + ".get(" + i + ")");
384  648 list.add(create(authorList.get(i)));
385    }
386  648 setLocationWithinModule(context);
387  648 return list;
388    }
389   
 
390  648 toggle private final AuthorVo create(final Author author) {
391  648 if (author == null) {
392  0 return null;
393    }
394  648 final AuthorVo a = new AuthorVo();
395  648 final String context = getCurrentContext().getLocationWithinModule();
396  648 if (author.getName() != null) {
397  648 setLocationWithinModule(context + ".getName()");
398  648 a.setName(create(author.getName()));
399    }
400  648 if (author.getEmail() != null) {
401  648 setLocationWithinModule(context + ".getEmail()");
402  648 a.setEmail(author.getEmail());
403    }
404  648 setLocationWithinModule(context);
405  648 return a;
406    }
407   
 
408  648 toggle private final ChapterListVo create(final ChapterList chapterList)
409    throws IllegalModuleDataException {
410  648 if (chapterList == null) {
411  0 return null;
412    }
413  648 final ChapterListVo list = new ChapterListVo();
414  648 final String context = getCurrentContext().getLocationWithinModule();
415  3137 for (int i = 0; i < chapterList.size(); i++) {
416  2489 setLocationWithinModule(context + ".get(" + i + ")");
417  2489 list.add(create(chapterList.get(i)));
418    }
419  648 setLocationWithinModule(context);
420  648 return list;
421    }
422   
 
423  2489 toggle private final ChapterVo create(final Chapter chapter)
424    throws IllegalModuleDataException {
425  2489 if (chapter == null) {
426  0 return null;
427    }
428  2489 final ChapterVo c = new ChapterVo();
429  2489 final String context = getCurrentContext().getLocationWithinModule();
430  2489 if (chapter.getTitle() != null) {
431  2489 setLocationWithinModule(context + ".getTitle()");
432  2489 c.setTitle(create(chapter.getTitle()));
433    }
434  2489 if (chapter.getNoNumber() != null) {
435  660 setLocationWithinModule(context + ".getNoNumber()");
436  660 c.setNoNumber(chapter.getNoNumber());
437    }
438  2489 if (chapter.getIntroduction() != null) {
439  2311 setLocationWithinModule(context + ".getIntroduction()");
440  2311 c.setIntroduction(create(chapter.getIntroduction()));
441    }
442  2489 if (chapter.getSectionList() != null) {
443  1519 setLocationWithinModule(context + ".getSectionList()");
444  1519 c.setSectionList(create(chapter.getSectionList()));
445    }
446  2489 setLocationWithinModule(context);
447  2489 return c;
448    }
449   
 
450  266 toggle private LiteratureItemListVo create(final LiteratureItemList literatureItemList) {
451  266 if (literatureItemList == null) {
452  0 return null;
453    }
454  266 final LiteratureItemListVo list = new LiteratureItemListVo();
455  266 final String context = getCurrentContext().getLocationWithinModule();
456  1397 for (int i = 0; i < literatureItemList.size(); i++) {
457  1131 setLocationWithinModule(context + ".get(" + i + ")");
458  1131 list.add(create(literatureItemList.get(i)));
459    }
460  266 setLocationWithinModule(context);
461  266 return list;
462    }
463   
 
464  1131 toggle private LiteratureItemVo create(final LiteratureItem item) {
465  1131 if (item == null) {
466  0 return null;
467    }
468  1131 final LiteratureItemVo it = new LiteratureItemVo();
469  1131 final String context = getCurrentContext().getLocationWithinModule();
470  1131 if (item.getLabel() != null) {
471  1131 setLocationWithinModule(context + ".getLabel()");
472  1131 it.setLabel(item.getLabel());
473    }
474  1131 if (item.getItem() != null) {
475  1131 setLocationWithinModule(context + ".getItem()");
476  1131 it.setItem(create(item.getItem()));
477    }
478  1131 setLocationWithinModule(context);
479  1131 return it;
480   
481    }
482   
 
483  1519 toggle private final SectionListVo create(final SectionList sectionList)
484    throws IllegalModuleDataException {
485  1519 if (sectionList == null) {
486  0 return null;
487    }
488  1519 final SectionListVo list = new SectionListVo();
489  1519 final String context = getCurrentContext().getLocationWithinModule();
490  6532 for (int i = 0; i < sectionList.size(); i++) {
491  5013 setLocationWithinModule(context + ".get(" + i + ")");
492  5013 list.add(create(sectionList.get(i)));
493    }
494  1519 setLocationWithinModule(context);
495  1519 return list;
496    }
497   
 
498  5013 toggle private final SectionVo create(final Section section)
499    throws IllegalModuleDataException {
500  5013 if (section == null) {
501  0 return null;
502    }
503  5013 final SectionVo s = new SectionVo();
504  5013 final String context = getCurrentContext().getLocationWithinModule();
505  5013 if (section.getTitle() != null) {
506  5013 setLocationWithinModule(context + ".getTitle()");
507  5013 s.setTitle(create(section.getTitle()));
508    }
509  5013 if (section.getNoNumber() != null) {
510  0 setLocationWithinModule(context + ".getNoNumber()");
511  0 s.setNoNumber(section.getNoNumber());
512    }
513  5013 if (section.getIntroduction() != null) {
514  4994 setLocationWithinModule(context + ".getIntroduction()");
515  4994 s.setIntroduction(create(section.getIntroduction()));
516    }
517  5013 if (section.getSubsectionList() != null) {
518  3281 setLocationWithinModule(context + ".getSubsectionList()");
519  3281 s.setSubsectionList(create(section.getSubsectionList()));
520    }
521  5013 setLocationWithinModule(context);
522  5013 return s;
523    }
524   
 
525  3281 toggle private final SubsectionListVo create(final SubsectionList subsectionList)
526    throws IllegalModuleDataException {
527  3281 if (subsectionList == null) {
528  0 return null;
529    }
530  3281 final SubsectionListVo list = new SubsectionListVo();
531  3281 final String context = getCurrentContext().getLocationWithinModule();
532  24323 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  21042 if (subsectionList.get(i).getSubsection() != null) {
538  1208 setLocationWithinModule(context + ".get(" + i + ").getSubsection()");
539  1208 list.add(create(subsectionList.get(i).getSubsection()));
540  19834 } else if (subsectionList.get(i).getNode() != null) {
541  19834 setLocationWithinModule(context + ".get(" + i + ").getNode()");
542  19834 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  3281 setLocationWithinModule(context);
549  3281 return list;
550    }
551   
 
552  1208 toggle private final SubsectionVo create(final Subsection subsection) {
553  1208 if (subsection == null) {
554  0 return null;
555    }
556  1208 final SubsectionVo s = new SubsectionVo();
557  1208 final String context = getCurrentContext().getLocationWithinModule();
558  1208 if (subsection.getId() != null) {
559  12 setLocationWithinModule(context + ".getId()");
560  12 s.setId(subsection.getId());
561    }
562  1208 if (subsection.getLevel() != null) {
563  0 setLocationWithinModule(context + ".getLevel()");
564  0 s.setLevel(subsection.getLevel());
565    }
566  1208 if (subsection.getTitle() != null) {
567  274 setLocationWithinModule(context + ".getTitle()");
568  274 s.setTitle(create(subsection.getTitle()));
569    }
570  1208 if (subsection.getLatex() != null) {
571  1208 setLocationWithinModule(context + ".getLatex()");
572  1208 s.setLatex(create(subsection.getLatex()));
573    }
574  1208 setLocationWithinModule(context);
575  1208 return s;
576    }
577   
 
578  19834 toggle private final NodeVo create(final Node node)
579    throws IllegalModuleDataException {
580  19834 if (node == null) {
581  0 return null;
582    }
583  19834 final NodeVo n = new NodeVo();
584  19834 final String context = getCurrentContext().getLocationWithinModule();
585  19834 if (node.getName() != null) {
586  10055 setLocationWithinModule(context + ".getName()");
587  10055 n.setName(create(node.getName()));
588    }
589  19834 if (node.getId() != null) {
590  19834 setLocationWithinModule(context + ".getId()");
591  19834 n.setId(node.getId());
592    }
593  19834 if (node.getLevel() != null) {
594  12532 setLocationWithinModule(context + ".getLevel()");
595  12532 n.setLevel(node.getLevel());
596    }
597  19834 if (node.getTitle() != null) {
598  10051 setLocationWithinModule(context + ".getTitle()");
599  10051 n.setTitle(create(node.getTitle()));
600    }
601  19834 if (node.getPrecedingText() != null) {
602  16639 setLocationWithinModule(context + ".getPrecedingText()");
603  16639 n.setPrecedingText(create(node.getPrecedingText()));
604    }
605  19834 if (node.getNodeType() != null) {
606  19834 setLocationWithinModule(context + ".getNodeType()");
607  19834 if (node.getNodeType() instanceof Axiom) {
608  3647 setLocationWithinModule(context + ".getNodeType().getAxiom()");
609  3647 n.setNodeType(create((Axiom) node.getNodeType()));
610  16187 } else if (node.getNodeType() instanceof InitialPredicateDefinition) {
611  380 setLocationWithinModule(context + ".getNodeType().getInitialPredicateDefinition()");
612  380 n.setNodeType(create((InitialPredicateDefinition) node.getNodeType()));
613  15807 } else if (node.getNodeType() instanceof PredicateDefinition) {
614  1316 setLocationWithinModule(context + ".getNodeType().getPredicateDefinition()");
615  1316 n.setNodeType(create((PredicateDefinition) node.getNodeType()));
616  14491 } else if (node.getNodeType() instanceof InitialFunctionDefinition) {
617  9 setLocationWithinModule(context + ".getNodeType().getInitialFunctionDefinition()");
618  9 n.setNodeType(create((InitialFunctionDefinition) node.getNodeType()));
619  14482 } else if (node.getNodeType() instanceof FunctionDefinition) {
620  2634 setLocationWithinModule(context + ".getNodeType().getFunctionDefinition()");
621  2634 n.setNodeType(create((FunctionDefinition) node.getNodeType()));
622  11848 } else if (node.getNodeType() instanceof Proposition) {
623  9939 setLocationWithinModule(context + ".getNodeType().getProposition()");
624  9939 n.setNodeType(create((Proposition) node.getNodeType()));
625  1909 } else if (node.getNodeType() instanceof Rule) {
626  1909 setLocationWithinModule(context + ".getNodeType().getRule()");
627  1909 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  19834 if (node.getSucceedingText() != null) {
636  3858 setLocationWithinModule(context + ".getSucceedingText()");
637  3858 n.setSucceedingText(create(node.getSucceedingText()));
638    }
639  19834 setLocationWithinModule(context);
640  19834 return n;
641    }
642   
 
643  3647 toggle private final AxiomVo create(final Axiom axiom) {
644  3647 if (axiom == null) {
645  0 return null;
646    }
647  3647 final AxiomVo a = new AxiomVo();
648  3647 final String context = getCurrentContext().getLocationWithinModule();
649  3647 if (axiom.getDefinedOperator() != null) {
650  255 setLocationWithinModule(context + ".getDefinedOperator()");
651  255 a.setDefinedOperator(axiom.getDefinedOperator());
652    }
653  3647 if (axiom.getFormula() != null) {
654  3647 setLocationWithinModule(context + ".getFormula()");
655  3647 a.setFormula(create(axiom.getFormula()));
656    }
657  3647 if (axiom.getDescription() != null) {
658  0 setLocationWithinModule(context + ".getDescription()");
659  0 a.setDescription(create(axiom.getDescription()));
660    }
661  3647 setLocationWithinModule(context);
662  3647 return a;
663    }
664   
 
665  380 toggle private final InitialPredicateDefinitionVo create(final InitialPredicateDefinition definition) {
666  380 if (definition == null) {
667  0 return null;
668    }
669  380 final InitialPredicateDefinitionVo d = new InitialPredicateDefinitionVo();
670  380 final String context = getCurrentContext().getLocationWithinModule();
671  380 if (definition.getLatexPattern() != null) {
672  380 setLocationWithinModule(context + ".getLatexPattern()");
673  380 d.setLatexPattern(definition.getLatexPattern());
674    }
675  380 if (definition.getName() != null) {
676  380 setLocationWithinModule(context + ".getName()");
677  380 d.setName(definition.getName());
678    }
679  380 if (definition.getArgumentNumber() != null) {
680  380 setLocationWithinModule(context + ".getArgumentNumber()");
681  380 d.setArgumentNumber(definition.getArgumentNumber());
682    }
683  380 if (definition.getPredCon() != null) {
684  380 setLocationWithinModule(context + ".getPredCon()");
685  380 d.setPredCon(create(definition.getPredCon()));
686    }
687  380 if (definition.getDescription() != null) {
688  0 setLocationWithinModule(context + ".getDescription()");
689  0 d.setDescription(create(definition.getDescription()));
690    }
691  380 setLocationWithinModule(context);
692  380 return d;
693    }
694   
 
695  1316 toggle private final PredicateDefinitionVo create(final PredicateDefinition definition) {
696  1316 if (definition == null) {
697  0 return null;
698    }
699  1316 final PredicateDefinitionVo d = new PredicateDefinitionVo();
700  1316 final String context = getCurrentContext().getLocationWithinModule();
701  1316 if (definition.getLatexPattern() != null) {
702  1316 setLocationWithinModule(context + ".getLatexPattern()");
703  1316 d.setLatexPattern(definition.getLatexPattern());
704    }
705  1316 if (definition.getName() != null) {
706  1316 setLocationWithinModule(context + ".getName()");
707  1316 d.setName(definition.getName());
708    }
709  1316 if (definition.getArgumentNumber() != null) {
710  1316 setLocationWithinModule(context + ".getArgumentNumber()");
711  1316 d.setArgumentNumber(definition.getArgumentNumber());
712    }
713  1316 if (definition.getFormula() != null) {
714  1316 setLocationWithinModule(context + ".getFormula()");
715  1316 d.setFormula(create(definition.getFormula()));
716    }
717  1316 if (definition.getDescription() != null) {
718  0 setLocationWithinModule(context + ".getDescription()");
719  0 d.setDescription(create(definition.getDescription()));
720    }
721  1316 setLocationWithinModule(context);
722  1316 return d;
723    }
724   
 
725  9 toggle private final InitialFunctionDefinitionVo create(final InitialFunctionDefinition definition) {
726  9 if (definition == null) {
727  0 return null;
728    }
729  9 final InitialFunctionDefinitionVo d = new InitialFunctionDefinitionVo();
730  9 final String context = getCurrentContext().getLocationWithinModule();
731  9 if (definition.getLatexPattern() != null) {
732  9 setLocationWithinModule(context + ".getLatexPattern()");
733  9 d.setLatexPattern(definition.getLatexPattern());
734    }
735  9 if (definition.getArgumentNumber() != null) {
736  9 setLocationWithinModule(context + ".getArgumentNumber()");
737  9 d.setArgumentNumber(definition.getArgumentNumber());
738    }
739  9 if (definition.getName() != null) {
740  9 setLocationWithinModule(context + ".getName()");
741  9 d.setName(definition.getName());
742    }
743  9 if (definition.getFunCon() != null) {
744  9 setLocationWithinModule(context + ".getFunCon()");
745  9 d.setFunCon(create(definition.getFunCon()));
746    }
747  9 if (definition.getDescription() != null) {
748  0 setLocationWithinModule(context + ".getDescription()");
749  0 d.setDescription(create(definition.getDescription()));
750    }
751  9 setLocationWithinModule(context);
752  9 return d;
753    }
754   
 
755  2634 toggle private final FunctionDefinitionVo create(final FunctionDefinition definition) {
756  2634 if (definition == null) {
757  0 return null;
758    }
759  2634 final FunctionDefinitionVo d = new FunctionDefinitionVo();
760  2634 final String context = getCurrentContext().getLocationWithinModule();
761  2634 if (definition.getLatexPattern() != null) {
762  2634 setLocationWithinModule(context + ".getLatexPattern()");
763  2634 d.setLatexPattern(definition.getLatexPattern());
764    }
765  2634 if (definition.getArgumentNumber() != null) {
766  2634 setLocationWithinModule(context + ".getArgumentNumber()");
767  2634 d.setArgumentNumber(definition.getArgumentNumber());
768    }
769  2634 if (definition.getName() != null) {
770  2634 setLocationWithinModule(context + ".getName()");
771  2634 d.setName(definition.getName());
772    }
773  2634 if (definition.getFormula() != null) {
774  2634 setLocationWithinModule(context + ".getFormula()");
775  2634 d.setFormula(create(definition.getFormula()));
776    }
777  2634 if (definition.getDescription() != null) {
778  0 setLocationWithinModule(context + ".getDescription()");
779  0 d.setDescription(create(definition.getDescription()));
780    }
781  2634 setLocationWithinModule(context);
782  2634 return d;
783    }
784   
 
785  9939 toggle private final PropositionVo create(final Proposition proposition) {
786  9939 if (proposition == null) {
787  0 return null;
788    }
789  9939 final PropositionVo p = new PropositionVo();
790  9939 final String context = getCurrentContext().getLocationWithinModule();
791  9939 if (proposition.getFormula() != null) {
792  9939 setLocationWithinModule(context + ".getFormula()");
793  9939 p.setFormula(create(proposition.getFormula()));
794    }
795  9939 if (proposition.getDescription() != null) {
796  164 setLocationWithinModule(context + ".getDescription()");
797  164 p.setDescription(create(proposition.getDescription()));
798    }
799  9939 if (proposition.getProofList() != null) {
800  2826 setLocationWithinModule(context + ".getProofList()");
801  2826 p.setProofList(create(proposition.getProofList()));
802    }
803  9939 if (proposition.getFormalProofList() != null) {
804  623 setLocationWithinModule(context + ".getFormalProofList()");
805  623 p.setFormalProofList(create(proposition.getFormalProofList()));
806    }
807  9939 setLocationWithinModule(context);
808  9939 return p;
809    }
810   
 
811  1909 toggle private final RuleVo create(final Rule rule) {
812  1909 if (rule == null) {
813  0 return null;
814    }
815  1909 final RuleVo r = new RuleVo();
816  1909 final String context = getCurrentContext().getLocationWithinModule();
817  1909 if (rule.getName() != null) {
818  1909 setLocationWithinModule(context + ".getName()");
819  1909 r.setName(rule.getName());
820    }
821  1909 if (rule.getVersion() != null) {
822  1909 setLocationWithinModule(context + ".getVersion()");
823  1909 r.setVersion(rule.getVersion());
824    }
825  1909 if (rule.getLinkList() != null) {
826  201 setLocationWithinModule(context + ".getLinkList()");
827  201 r.setLinkList(create(rule.getLinkList()));
828    }
829  1909 if (rule.getDescription() != null) {
830  1909 setLocationWithinModule(context + ".getDescription()");
831  1909 r.setDescription(create(rule.getDescription()));
832    }
833  1909 if (rule.getChangedRuleList() != null) {
834  11 setLocationWithinModule(context + ".getChangedRuleList()");
835  11 r.setChangedRuleList(create(rule.getChangedRuleList()));
836    }
837  1909 if (rule.getProofList() != null) {
838  11 setLocationWithinModule(context + ".getProofList()");
839  11 r.setProofList(create(rule.getProofList()));
840    }
841  1909 setLocationWithinModule(context);
842  1909 return r;
843    }
844   
 
845  11 toggle private final ChangedRuleListVo create(final ChangedRuleList changedRuleList) {
846  11 if (changedRuleList == null) {
847  0 return null;
848    }
849  11 final ChangedRuleListVo list = new ChangedRuleListVo();
850  11 final String context = getCurrentContext().getLocationWithinModule();
851  99 for (int i = 0; i < changedRuleList.size(); i++) {
852  88 setLocationWithinModule(context + ".get(" + i + ")");
853  88 list.add(create(changedRuleList.get(i)));
854    }
855  11 setLocationWithinModule(context);
856  11 return list;
857    }
858   
 
859  88 toggle private final ChangedRuleVo create(final ChangedRule rule) {
860  88 if (rule == null) {
861  0 return null;
862    }
863  88 final ChangedRuleVo r = new ChangedRuleVo();
864  88 final String context = getCurrentContext().getLocationWithinModule();
865  88 if (rule.getName() != null) {
866  88 setLocationWithinModule(context + ".getName()");
867  88 r.setName(rule.getName());
868    }
869  88 if (rule.getVersion() != null) {
870  88 setLocationWithinModule(context + ".getVersion()");
871  88 r.setVersion(rule.getVersion());
872    }
873  88 if (rule.getDescription() != null) {
874  88 setLocationWithinModule(context + ".getDescription()");
875  88 r.setDescription(create(rule.getDescription()));
876    }
877  88 setLocationWithinModule(context);
878  88 return r;
879    }
880   
 
881  201 toggle private final LinkListVo create(final LinkList linkList) {
882  201 if (linkList == null) {
883  0 return null;
884    }
885  201 final LinkListVo list = new LinkListVo();
886  201 final String context = getCurrentContext().getLocationWithinModule();
887  413 for (int i = 0; i < linkList.size(); i++) {
888  212 setLocationWithinModule(context + ".get(" + i + ")");
889  212 list.add(linkList.get(i));
890    }
891  201 setLocationWithinModule(context);
892  201 return list;
893    }
894   
 
895  2837 toggle private final ProofListVo create(final ProofList proofList) {
896  2837 if (proofList == null) {
897  0 return null;
898    }
899  2837 final ProofListVo list = new ProofListVo();
900  2837 final String context = getCurrentContext().getLocationWithinModule();
901  5837 for (int i = 0; i < proofList.size(); i++) {
902  3000 setLocationWithinModule(context + ".get(" + i + ")");
903  3000 list.add(create(proofList.get(i)));
904    }
905  2837 setLocationWithinModule(context);
906  2837 return list;
907    }
908   
 
909  3000 toggle private final ProofVo create(final Proof proof) {
910  3000 if (proof == null) {
911  0 return null;
912    }
913  3000 final ProofVo p = new ProofVo();
914  3000 final String context = getCurrentContext().getLocationWithinModule();
915  3000 setLocationWithinModule(context + ".getKind()");
916  3000 p.setKind(proof.getKind());
917  3000 setLocationWithinModule(context + ".getLevel()");
918  3000 p.setLevel(proof.getLevel());
919  3000 setLocationWithinModule(context);
920  3000 if (proof.getNonFormalProof() != null) {
921  3000 setLocationWithinModule(context + ".getNonFormalProof()");
922  3000 p.setNonFormalProof(create(proof.getNonFormalProof()));
923    }
924  3000 setLocationWithinModule(context);
925  3000 return p;
926    }
927   
 
928  623 toggle private final FormalProofListVo create(final FormalProofList proofList) {
929  623 if (proofList == null) {
930  0 return null;
931    }
932  623 final FormalProofListVo list = new FormalProofListVo();
933  623 final String context = getCurrentContext().getLocationWithinModule();
934  1246 for (int i = 0; i < proofList.size(); i++) {
935  623 setLocationWithinModule(context + ".get(" + i + ")");
936  623 list.add(create(proofList.get(i)));
937    }
938  623 setLocationWithinModule(context);
939  623 return list;
940    }
941   
 
942  623 toggle private final FormalProofVo create(final FormalProof proof) {
943  623 if (proof == null) {
944  0 return null;
945    }
946  623 final FormalProofVo p = new FormalProofVo();
947  623 final String context = getCurrentContext().getLocationWithinModule();
948  623 setLocationWithinModule(context);
949  623 if (proof.getPrecedingText() != null) {
950  0 setLocationWithinModule(context + ".getPrecedingText()");
951  0 p.setPrecedingText(create(proof.getPrecedingText()));
952    }
953  623 if (proof.getFormalProofLineList() != null) {
954  623 setLocationWithinModule(context + ".getFormalProofLineList()");
955  623 p.setFormalProofLineList(create(proof.getFormalProofLineList()));
956    }
957  623 if (proof.getSucceedingText() != null) {
958  0 setLocationWithinModule(context + ".getSucceedingText()");
959  0 p.setSucceedingText(create(proof.getSucceedingText()));
960    }
961  623 setLocationWithinModule(context);
962  623 return p;
963    }
964   
 
965  1173 toggle private final FormalProofLineListVo create(final FormalProofLineList proofList) {
966  1173 if (proofList == null) {
967  0 return null;
968    }
969  1173 final FormalProofLineListVo list = new FormalProofLineListVo();
970  1173 final String context = getCurrentContext().getLocationWithinModule();
971  8081 for (int i = 0; i < proofList.size(); i++) {
972  6908 setLocationWithinModule(context + ".get(" + i + ")");
973  6908 if (proofList.get(i) instanceof ConditionalProof) {
974  550 list.add(create((ConditionalProof) proofList.get(i)));
975    } else {
976  6358 list.add(create(proofList.get(i)));
977    }
978    }
979  1173 setLocationWithinModule(context);
980  1173 return list;
981    }
982   
 
983  6358 toggle private final FormalProofLineVo create(final FormalProofLine proofLine) {
984  6358 if (proofLine == null) {
985  0 return null;
986    }
987  6358 final FormalProofLineVo line = new FormalProofLineVo();
988  6358 final String context = getCurrentContext().getLocationWithinModule();
989  6358 if (proofLine.getLabel() != null) {
990  6347 setLocationWithinModule(context + ".getLabel()");
991  6347 line.setLabel(proofLine.getLabel());
992    }
993  6358 if (proofLine.getFormula() != null) {
994  6358 setLocationWithinModule(context + ".getFormula()");
995  6358 line.setFormula(create(proofLine.getFormula()));
996    }
997  6358 if (proofLine.getReason() != null) {
998  6358 setLocationWithinModule(context + ".getReason()");
999  6358 line.setReason(create(proofLine.getReason()));
1000    }
1001  6358 setLocationWithinModule(context);
1002  6358 return line;
1003    }
1004   
 
1005  550 toggle private final ConditionalProofVo create(final ConditionalProof proofLine) {
1006  550 if (proofLine == null) {
1007  0 return null;
1008    }
1009  550 final ConditionalProofVo line = new ConditionalProofVo();
1010  550 final String context = getCurrentContext().getLocationWithinModule();
1011  550 if (proofLine.getHypothesis() != null) {
1012  550 setLocationWithinModule(context + ".getHypothesis()");
1013  550 line.setHypothesis(proofLine.getHypothesis());
1014    }
1015  550 if (proofLine.getFormalProofLineList() != null) {
1016  550 setLocationWithinModule(context + ".getFormalProofLineList()");
1017  550 line.setFormalProofLineList(create(proofLine.getFormalProofLineList()));
1018    }
1019  550 if (proofLine.getConclusion() != null) {
1020  550 setLocationWithinModule(context + ".getConclusion()");
1021  550 line.setConclusion(create(proofLine.getConclusion()));
1022    }
1023  550 setLocationWithinModule(context);
1024  550 return line;
1025    }
1026   
 
1027  6358 toggle private final Reason create(final Reason reason) {
1028  6358 if (reason == null) {
1029  0 return null;
1030    }
1031  6358 final String context = getCurrentContext().getLocationWithinModule();
1032  6358 Reason result = null;
1033  6358 if (reason instanceof ModusPonens) {
1034  1740 setLocationWithinModule(context + ".getModusPonens()");
1035  1740 final ModusPonens r = (ModusPonens) reason;
1036  1740 result = new ModusPonensVo(r.getReference1(), r.getReference2());
1037  4618 } else if (reason instanceof Add) {
1038  1433 setLocationWithinModule(context + ".getAdd()");
1039  1433 final Add r = (Add) reason;
1040  1433 result = new AddVo(r.getReference());
1041  3185 } else if (reason instanceof Rename) {
1042  330 setLocationWithinModule(context + ".getRename()");
1043  330 final Rename r = (Rename) reason;
1044  330 result = new RenameVo(r.getReference(), r.getOriginalSubjectVariable(),
1045    r.getReplacementSubjectVariable(), r.getOccurrence());
1046  2855 } else if (reason instanceof SubstFree) {
1047  195 setLocationWithinModule(context + ".getSubstFree()");
1048  195 final SubstFree r = (SubstFree) reason;
1049  195 result = new SubstFreeVo(r.getReference(), r.getSubjectVariable(),
1050    r.getSubstituteTerm());
1051  2660 } else if (reason instanceof SubstFunc) {
1052  57 setLocationWithinModule(context + ".getSubstFunc()");
1053  57 final SubstFunc r = (SubstFunc) reason;
1054  57 result = new SubstFuncVo(r.getReference(), r.getFunctionVariable(),
1055    r.getSubstituteTerm());
1056  2603 } else if (reason instanceof SubstPred) {
1057  2408 setLocationWithinModule(context + ".getSubstPred()");
1058  2408 final SubstPred r = (SubstPred) reason;
1059  2408 result = new SubstPredVo(r.getReference(), r.getPredicateVariable(),
1060    r.getSubstituteFormula());
1061  195 } else if (reason instanceof Existential) {
1062  39 setLocationWithinModule(context + ".getExistential()");
1063  39 final Existential r = (Existential) reason;
1064  39 result = new ExistentialVo(r.getReference(), r.getSubjectVariable());
1065  156 } else if (reason instanceof Universal) {
1066  156 setLocationWithinModule(context + ".getUniversal()");
1067  156 final Universal r = (Universal) reason;
1068  156 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  6358 setLocationWithinModule(context);
1083  6358 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  550 toggle private final ConclusionVo create(final Conclusion conclusion) {
1104  550 if (conclusion == null) {
1105  0 return null;
1106    }
1107  550 final ConclusionVo c = new ConclusionVo();
1108  550 final String context = getCurrentContext().getLocationWithinModule();
1109  550 if (conclusion.getLabel() != null) {
1110  550 c.setLabel(conclusion.getLabel());
1111    }
1112  550 if (conclusion.getFormula() != null) {
1113  550 setLocationWithinModule(context + ".getFormula()");
1114  550 c.setFormula(create(conclusion.getFormula()));
1115    }
1116  550 setLocationWithinModule(context);
1117  550 return c;
1118    }
1119   
 
1120  24444 toggle private final FormulaVo create(final Formula formula) {
1121  24444 if (formula == null) {
1122  0 return null;
1123    }
1124  24444 final FormulaVo f = new FormulaVo();
1125  24444 final String context = getCurrentContext().getLocationWithinModule();
1126  24444 if (formula.getElement() != null) {
1127  24444 setLocationWithinModule(context + ".getElement()");
1128  24444 f.setElement(create(formula.getElement()));
1129    }
1130  24444 setLocationWithinModule(context);
1131  24444 return f;
1132    }
1133   
 
1134  678200 toggle private final Element create(final Element element) {
1135  678200 if (element == null) {
1136  0 return null;
1137    }
1138  678200 final Element e;
1139  678200 final String context = getCurrentContext().getLocationWithinModule();
1140  678200 if (element.isList()) {
1141  386868 setLocationWithinModule(context + ".getList()");
1142  386868 e = create(element.getList());
1143  291332 } else if (element.isAtom()) {
1144    // setLocationWithinModule(context + ".getAtom()");
1145  291332 return create(element.getAtom());
1146    } else {
1147  0 throw new RuntimeException("unknown element type: " + element);
1148    }
1149  386868 setLocationWithinModule(context);
1150  386868 return e;
1151    }
1152   
1153   
 
1154  386868 toggle private final DefaultElementList create(final ElementList list) {
1155  386868 if (list == null) {
1156  0 return null;
1157    }
1158  386868 final DefaultElementList n = new DefaultElementList(list.getOperator(), new Element[] {});
1159  386868 final String context = getCurrentContext().getLocationWithinModule();
1160  1040235 for (int i = 0; i < list.size(); i++) {
1161  653367 if (list.getElement(i).isList()) {
1162  362035 setLocationWithinModule(context + ".getElement(" + i + ")");
1163    }
1164  653367 n.add(create(list.getElement(i)));
1165    }
1166  386868 setLocationWithinModule(context);
1167  386868 return n;
1168    }
1169   
 
1170  291332 toggle private final DefaultAtom create(final Atom atom) {
1171  291332 if (atom == null) {
1172  0 return null;
1173    }
1174  291332 return new DefaultAtom(atom.getString());
1175    }
1176   
 
1177  64480 toggle private final LatexListVo create(final LatexList latexList) {
1178  64480 if (latexList == null) {
1179  0 return null;
1180    }
1181  64480 final LatexListVo list = new LatexListVo();
1182  64480 final String context = getCurrentContext().getLocationWithinModule();
1183  186972 for (int i = 0; i < latexList.size(); i++) {
1184  122492 setLocationWithinModule(context + ".get(" + i + ")");
1185  122492 list.add(create(latexList.get(i)));
1186    }
1187  64480 setLocationWithinModule(context);
1188  64480 return list;
1189    }
1190   
1191    /**
1192    * Creates LaTeX business object.
1193    *
1194    * @param latex LaTeX object.
1195    * @return LaTeX business object.
1196    */
 
1197  123140 toggle private final LatexVo create(final Latex latex) {
1198  123140 if (latex == null) {
1199  0 return null;
1200    }
1201  123140 final LatexVo lat = new LatexVo();
1202  123140 lat.setLanguage(latex.getLanguage());
1203  123140 lat.setLatex(latex.getLatex());
1204  123140 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  2058304 toggle protected void setLocationWithinModule(final String locationWithinModule) {
1213  2058304 getCurrentContext().setLocationWithinModule(locationWithinModule);
1214    }
1215   
1216    /**
1217    * Get current context within original.
1218    *
1219    * @return Current context.
1220    */
 
1221  3534607 toggle protected final ModuleContext getCurrentContext() {
1222  3534607 return currentContext;
1223    }
1224   
1225    /**
1226    * Get original QEDEQ module.
1227    *
1228    * @return Original QEDEQ module.
1229    */
 
1230  117312 toggle protected final Qedeq getQedeqOriginal() {
1231  117312 return original;
1232    }
1233   
1234    }