Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
450   786   177   11,25
206   679   0,39   40
40     4,43  
1    
 
  QedeqNotNullTraverser       Line # 67 450 177 89,9% 0.89942527
 
  (37)
 
1    /* $Id: QedeqNotNullTraverser.java,v 1.1 2008/07/26 07:59:34 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU General Public
9    * License as published by the Free Software Foundation; either
10    * version 2 of the License, or (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    * GNU General Public License for more details.
16    */
17   
18    package org.qedeq.kernel.visitor;
19   
20    import org.qedeq.kernel.base.list.Atom;
21    import org.qedeq.kernel.base.list.Element;
22    import org.qedeq.kernel.base.list.ElementList;
23    import org.qedeq.kernel.base.module.Author;
24    import org.qedeq.kernel.base.module.AuthorList;
25    import org.qedeq.kernel.base.module.Axiom;
26    import org.qedeq.kernel.base.module.Chapter;
27    import org.qedeq.kernel.base.module.ChapterList;
28    import org.qedeq.kernel.base.module.Formula;
29    import org.qedeq.kernel.base.module.FunctionDefinition;
30    import org.qedeq.kernel.base.module.Header;
31    import org.qedeq.kernel.base.module.Import;
32    import org.qedeq.kernel.base.module.ImportList;
33    import org.qedeq.kernel.base.module.Latex;
34    import org.qedeq.kernel.base.module.LatexList;
35    import org.qedeq.kernel.base.module.LinkList;
36    import org.qedeq.kernel.base.module.LiteratureItem;
37    import org.qedeq.kernel.base.module.LiteratureItemList;
38    import org.qedeq.kernel.base.module.Location;
39    import org.qedeq.kernel.base.module.LocationList;
40    import org.qedeq.kernel.base.module.Node;
41    import org.qedeq.kernel.base.module.PredicateDefinition;
42    import org.qedeq.kernel.base.module.Proof;
43    import org.qedeq.kernel.base.module.ProofList;
44    import org.qedeq.kernel.base.module.Proposition;
45    import org.qedeq.kernel.base.module.Qedeq;
46    import org.qedeq.kernel.base.module.Rule;
47    import org.qedeq.kernel.base.module.Section;
48    import org.qedeq.kernel.base.module.SectionList;
49    import org.qedeq.kernel.base.module.Specification;
50    import org.qedeq.kernel.base.module.Subsection;
51    import org.qedeq.kernel.base.module.SubsectionList;
52    import org.qedeq.kernel.base.module.Term;
53    import org.qedeq.kernel.base.module.UsedByList;
54    import org.qedeq.kernel.base.module.VariableList;
55    import org.qedeq.kernel.common.ModuleAddress;
56    import org.qedeq.kernel.common.ModuleContext;
57    import org.qedeq.kernel.common.ModuleDataException;
58   
59   
60    /**
61    * Traverse QEDEQ module. Calls visitors of {@link org.qedeq.kernel.visitor.QedeqVisitor}
62    * for non <code>null</code> arguments.
63    *
64    * @version $Revision: 1.1 $
65    * @author Michael Meyling
66    */
 
67    public class QedeqNotNullTraverser implements QedeqTraverser {
68   
69    /** Current context during creation. */
70    private ModuleContext currentContext;
71   
72    /**
73    * These methods are called if a node is visited. To start the whole process just call
74    * {@link #accept(Qedeq)}.
75    */
76    private QedeqVisitor visitor;
77   
78    /** Is sub node traverse currently blocked? */
79    private boolean blocked;
80   
81    /**
82    * Constructor.
83    *
84    * @param globalContext Module location information.
85    * @param visitor These methods are called if a node is visited.
86    */
 
87  32960 toggle public QedeqNotNullTraverser(final ModuleAddress globalContext, final QedeqVisitor visitor) {
88  32960 currentContext = globalContext.createModuleContext();
89  32960 this.visitor = visitor;
90    }
91   
 
92  32958 toggle public void accept(final Qedeq qedeq) throws ModuleDataException {
93  32958 getCurrentContext().setLocationWithinModule("");
94  32958 blocked = false;
95  32958 if (qedeq == null) {
96  0 throw new NullPointerException("null QEDEQ module");
97    }
98  32958 final String context = getCurrentContext().getLocationWithinModule();
99  32958 visitor.visitEnter(qedeq);
100  32956 if (qedeq.getHeader() != null) {
101  32956 getCurrentContext().setLocationWithinModule(context + "getHeader()");
102  32956 accept(qedeq.getHeader());
103    }
104  32389 if (qedeq.getChapterList() != null) {
105  32389 getCurrentContext().setLocationWithinModule(context + "getChapterList()");
106  32389 accept(qedeq.getChapterList());
107    }
108  578 if (qedeq.getLiteratureItemList() != null) {
109  246 getCurrentContext().setLocationWithinModule(context + "getLiteratureItemList()");
110  246 accept(qedeq.getLiteratureItemList());
111    }
112  408 setLocationWithinModule(context);
113  408 visitor.visitLeave(qedeq);
114  408 setLocationWithinModule(context);
115    }
116   
 
117  32956 toggle public void accept(final Header header) throws ModuleDataException {
118  32956 if (blocked || header == null) {
119  0 return;
120    }
121  32956 final String context = getCurrentContext().getLocationWithinModule();
122  32956 visitor.visitEnter(header);
123  32932 if (header.getSpecification() != null) {
124  32932 setLocationWithinModule(context + ".getSpecification()");
125  32932 accept(header.getSpecification());
126    }
127  32827 if (header.getTitle() != null) {
128  32827 setLocationWithinModule(context + ".getTitle()");
129  32827 accept(header.getTitle());
130    }
131  32781 if (header.getSummary() != null) {
132  32781 setLocationWithinModule(context + ".getSummary()");
133  32781 accept(header.getSummary());
134    }
135  32735 if (header.getAuthorList() != null) {
136  32735 setLocationWithinModule(context + ".getAuthorList()");
137  32735 accept(header.getAuthorList());
138    }
139  32663 if (header.getImportList() != null) {
140  24707 setLocationWithinModule(context + ".getImportList()");
141  24707 accept(header.getImportList());
142    }
143  32444 if (header.getUsedByList() != null) {
144  8001 setLocationWithinModule(context + ".getUsedByList()");
145  8001 accept(header.getUsedByList());
146    }
147  32389 setLocationWithinModule(context);
148  32389 visitor.visitLeave(header);
149  32389 setLocationWithinModule(context);
150    }
151   
 
152  8001 toggle public void accept(final UsedByList usedByList) throws ModuleDataException {
153  8001 if (blocked || usedByList == null) {
154  7850 return;
155    }
156  151 final String context = getCurrentContext().getLocationWithinModule();
157  151 visitor.visitEnter(usedByList);
158  237 for (int i = 0; i < usedByList.size(); i++) {
159  141 setLocationWithinModule(context + ".get(" + i + ")");
160  141 accept(usedByList.get(i));
161    }
162  96 setLocationWithinModule(context);
163  96 visitor.visitLeave(usedByList);
164  96 setLocationWithinModule(context);
165    }
166   
 
167  24707 toggle public void accept(final ImportList importList) throws ModuleDataException {
168  24707 if (blocked || importList == null) {
169  24194 return;
170    }
171  513 final String context = getCurrentContext().getLocationWithinModule();
172  513 visitor.visitEnter(importList);
173  1003 for (int i = 0; i < importList.size(); i++) {
174  709 setLocationWithinModule(context + ".get(" + i + ")");
175  709 accept(importList.get(i));
176    }
177  294 setLocationWithinModule(context);
178  294 visitor.visitLeave(importList);
179  294 setLocationWithinModule(context);
180    }
181   
 
182  709 toggle public void accept(final Import imp) throws ModuleDataException {
183  709 if (blocked || imp == null) {
184  44 return;
185    }
186  665 final String context = getCurrentContext().getLocationWithinModule();
187  665 visitor.visitEnter(imp);
188  532 if (imp.getSpecification() != null) {
189  532 setLocationWithinModule(context + ".getSpecification()");
190  532 accept(imp.getSpecification());
191    }
192  458 setLocationWithinModule(context);
193  458 visitor.visitLeave(imp);
194  458 setLocationWithinModule(context);
195    }
196   
 
197  33605 toggle public void accept(final Specification specification) throws ModuleDataException {
198  33605 if (blocked || specification == null) {
199  32064 return;
200    }
201  1541 final String context = getCurrentContext().getLocationWithinModule();
202  1541 visitor.visitEnter(specification);
203  1449 if (specification.getLocationList() != null) {
204  1449 setLocationWithinModule(context + ".getLocationList()");
205  1449 accept(specification.getLocationList());
206    }
207  1317 setLocationWithinModule(context);
208  1317 visitor.visitLeave(specification);
209  1317 setLocationWithinModule(context);
210    }
211   
 
212  1449 toggle public void accept(final LocationList locationList) throws ModuleDataException {
213  1449 if (blocked || locationList == null) {
214  438 return;
215    }
216  1011 final String context = getCurrentContext().getLocationWithinModule();
217  1011 visitor.visitEnter(locationList);
218  1999 for (int i = 0; i < locationList.size(); i++) {
219  1120 setLocationWithinModule(context + ".get(" + i + ")");
220  1120 accept(locationList.get(i));
221    }
222  879 setLocationWithinModule(context);
223  879 visitor.visitLeave(locationList);
224  879 setLocationWithinModule(context);
225    }
226   
 
227  1120 toggle public void accept(final Location location) throws ModuleDataException {
228  1120 if (blocked || location == null) {
229  0 return;
230    }
231  1120 final String context = getCurrentContext().getLocationWithinModule();
232  1120 visitor.visitEnter(location);
233  1036 setLocationWithinModule(context);
234  1036 visitor.visitLeave(location);
235  1036 setLocationWithinModule(context);
236    }
237   
 
238  32735 toggle public void accept(final AuthorList authorList) throws ModuleDataException {
239  32735 if (blocked || authorList == null) {
240  31979 return;
241    }
242  756 final String context = getCurrentContext().getLocationWithinModule();
243  756 visitor.visitEnter(authorList);
244  1416 for (int i = 0; i < authorList.size(); i++) {
245  732 setLocationWithinModule(context + ".get(" + i + ")");
246  732 accept(authorList.get(i));
247    }
248  684 setLocationWithinModule(context);
249  684 visitor.visitLeave(authorList);
250  684 setLocationWithinModule(context);
251    }
252   
 
253  732 toggle public void accept(final Author author) throws ModuleDataException {
254  732 if (blocked || author == null) {
255  274 return;
256    }
257  458 final String context = getCurrentContext().getLocationWithinModule();
258  458 visitor.visitEnter(author);
259  423 if (author.getName() != null) {
260  423 setLocationWithinModule(context + ".getName()");
261  423 accept(author.getName());
262    }
263  410 setLocationWithinModule(context);
264  410 visitor.visitLeave(author);
265  410 setLocationWithinModule(context);
266    }
267   
 
268  32389 toggle public void accept(final ChapterList chapterList) throws ModuleDataException {
269  32389 if (blocked || chapterList == null) {
270  121 return;
271    }
272  32268 final String context = getCurrentContext().getLocationWithinModule();
273  32268 visitor.visitEnter(chapterList);
274  142983 for (int i = 0; i < chapterList.size(); i++) {
275  142526 setLocationWithinModule(context + ".get(" + i + ")");
276  142526 accept(chapterList.get(i));
277    }
278  457 setLocationWithinModule(context);
279  457 visitor.visitLeave(chapterList);
280  457 setLocationWithinModule(context);
281    }
282   
 
283  142526 toggle public void accept(final Chapter chapter) throws ModuleDataException {
284  142526 if (blocked || chapter == null) {
285  1260 return;
286    }
287  141266 final String context = getCurrentContext().getLocationWithinModule();
288  141266 visitor.visitEnter(chapter);
289  141123 if (chapter.getTitle() != null) {
290  141123 setLocationWithinModule(context + ".getTitle()");
291  141123 accept(chapter.getTitle());
292    }
293  140877 if (chapter.getIntroduction() != null) {
294  140810 setLocationWithinModule(context + ".getIntroduction()");
295  140810 accept(chapter.getIntroduction());
296    }
297  140639 if (chapter.getSectionList() != null) {
298  72065 setLocationWithinModule(context + ".getSectionList()");
299  72065 accept(chapter.getSectionList());
300    }
301  109468 setLocationWithinModule(context);
302  109468 visitor.visitLeave(chapter);
303  109468 setLocationWithinModule(context);
304    }
305   
 
306  246 toggle public void accept(final LiteratureItemList literatureItemList)
307    throws ModuleDataException {
308  246 if (blocked || literatureItemList == null) {
309  6 return;
310    }
311  240 final String context = getCurrentContext().getLocationWithinModule();
312  240 visitor.visitEnter(literatureItemList);
313  968 for (int i = 0; i < literatureItemList.size(); i++) {
314  898 setLocationWithinModule(context + ".get(" + i + ")");
315  898 accept(literatureItemList.get(i));
316    }
317  70 setLocationWithinModule(context);
318  70 visitor.visitLeave(literatureItemList);
319  70 setLocationWithinModule(context);
320    }
321   
 
322  898 toggle public void accept(final LiteratureItem item) throws ModuleDataException {
323  898 if (blocked || item == null) {
324  0 return;
325    }
326  898 final String context = getCurrentContext().getLocationWithinModule();
327  898 visitor.visitEnter(item);
328  832 if (item.getItem() != null) {
329  832 setLocationWithinModule(context + ".getItem()");
330  832 accept(item.getItem());
331    }
332  734 setLocationWithinModule(context);
333  734 visitor.visitLeave(item);
334  734 setLocationWithinModule(context);
335    }
336   
 
337  72065 toggle public void accept(final SectionList sectionList) throws ModuleDataException {
338  72065 if (blocked || sectionList == null) {
339  40306 return;
340    }
341  31759 final String context = getCurrentContext().getLocationWithinModule();
342  31759 visitor.visitEnter(sectionList);
343  77500 for (int i = 0; i < sectionList.size(); i++) {
344  76912 setLocationWithinModule(context + ".get(" + i + ")");
345  76912 accept(sectionList.get(i));
346    }
347  588 setLocationWithinModule(context);
348  588 visitor.visitLeave(sectionList);
349  588 setLocationWithinModule(context);
350    }
351   
 
352  76912 toggle public void accept(final Section section) throws ModuleDataException {
353  76912 if (blocked || section == null) {
354  0 return;
355    }
356  76912 final String context = getCurrentContext().getLocationWithinModule();
357  76912 visitor.visitEnter(section);
358  76678 if (section.getTitle() != null) {
359  76678 setLocationWithinModule(context + ".getTitle()");
360  76678 accept(section.getTitle());
361    }
362  76198 if (section.getIntroduction() != null) {
363  76189 setLocationWithinModule(context + ".getIntroduction()");
364  76189 accept(section.getIntroduction());
365    }
366  75758 if (section.getSubsectionList() != null) {
367  64039 setLocationWithinModule(context + ".getSubsectionList()");
368  64039 accept(section.getSubsectionList());
369    }
370  45817 setLocationWithinModule(context);
371  45817 visitor.visitLeave(section);
372  45817 setLocationWithinModule(context);
373    }
374   
 
375  64039 toggle public void accept(final SubsectionList subsectionList) throws ModuleDataException {
376  64039 if (blocked || subsectionList == null) {
377  33212 return;
378    }
379  30827 final String context = getCurrentContext().getLocationWithinModule();
380  30827 visitor.visitEnter(subsectionList);
381  158022 for (int i = 0; i < subsectionList.size(); i++) {
382  157136 setLocationWithinModule(context + ".get(" + i + ")");
383    // TODO mime 20050608: here the Subsection context is type dependently specified
384  157136 if (subsectionList.get(i) instanceof Subsection) {
385  6290 accept((Subsection) subsectionList.get(i));
386  150846 } else if (subsectionList.get(i) instanceof Node) {
387  150846 accept((Node) subsectionList.get(i));
388  0 } else if (subsectionList.get(i) == null) {
389    // ignore
390    } else {
391  0 throw new IllegalArgumentException("unexpected subsection type: "
392    + subsectionList.get(i).getClass());
393    }
394    }
395  886 setLocationWithinModule(context);
396  886 visitor.visitLeave(subsectionList);
397  886 setLocationWithinModule(context);
398    }
399   
 
400  6290 toggle public void accept(final Subsection subsection) throws ModuleDataException {
401  6290 if (blocked || subsection == null) {
402  0 return;
403    }
404  6290 final String context = getCurrentContext().getLocationWithinModule();
405  6290 visitor.visitEnter(subsection);
406  6182 if (subsection.getTitle() != null) {
407  2024 setLocationWithinModule(context + ".getTitle()");
408  2024 accept(subsection.getTitle());
409    }
410  6062 if (subsection.getLatex() != null) {
411  6062 setLocationWithinModule(context + ".getLatex()");
412  6062 accept(subsection.getLatex());
413    }
414  5882 setLocationWithinModule(context);
415  5882 visitor.visitLeave(subsection);
416  5882 setLocationWithinModule(context);
417    }
418   
 
419  150846 toggle public void accept(final Node node) throws ModuleDataException {
420  150846 if (blocked || node == null) {
421  0 return;
422    }
423  150846 final String context = getCurrentContext().getLocationWithinModule();
424  150846 visitor.visitEnter(node);
425  149463 if (node.getName() != null) {
426  76217 setLocationWithinModule(context + ".getName()");
427  76217 accept(node.getName());
428    }
429  148665 if (node.getTitle() != null) {
430  75419 setLocationWithinModule(context + ".getTitle()");
431  75419 accept(node.getTitle());
432    }
433  147867 if (node.getPrecedingText() != null) {
434  143962 setLocationWithinModule(context + ".getPrecedingText()");
435  143962 accept(node.getPrecedingText());
436    }
437  146413 if (node.getNodeType() != null) {
438  146413 setLocationWithinModule(context + ".getNodeType()");
439  146413 if (node.getNodeType() instanceof Axiom) {
440  18527 setLocationWithinModule(context + ".getNodeType().getAxiom()");
441  18527 accept((Axiom) node.getNodeType());
442  127886 } else if (node.getNodeType() instanceof PredicateDefinition) {
443  25051 setLocationWithinModule(context + ".getNodeType().getPredicateDefinition()");
444  25051 accept((PredicateDefinition) node.getNodeType());
445  102835 } else if (node.getNodeType() instanceof FunctionDefinition) {
446  22602 setLocationWithinModule(context + ".getNodeType().getFunctionDefinition()");
447  22602 accept((FunctionDefinition) node.getNodeType());
448  80233 } else if (node.getNodeType() instanceof Proposition) {
449  76240 setLocationWithinModule(context + ".getNodeType().getProposition()");
450  76240 accept((Proposition) node.getNodeType());
451  3993 } else if (node.getNodeType() instanceof Rule) {
452  3993 setLocationWithinModule(context + ".getNodeType().getRule()");
453  3993 accept((Rule) node.getNodeType());
454    } else {
455  0 throw new IllegalArgumentException("unexpected node type: "
456    + node.getNodeType().getClass());
457    }
458    }
459  121727 if (node.getSucceedingText() != null) {
460  28688 setLocationWithinModule(context + ".getSucceedingText()");
461  28688 accept(node.getSucceedingText());
462    }
463  121443 setLocationWithinModule(context);
464  121443 visitor.visitLeave(node);
465  121443 setLocationWithinModule(context);
466    }
467   
 
468  18527 toggle public void accept(final Axiom axiom) throws ModuleDataException {
469  18527 if (blocked || axiom == null) {
470  15502 return;
471    }
472  3025 final String context = getCurrentContext().getLocationWithinModule();
473  3025 visitor.visitEnter(axiom);
474  2913 if (axiom.getFormula() != null) {
475  2913 setLocationWithinModule(context + ".getFormula()");
476  2913 accept(axiom.getFormula());
477    }
478  668 if (axiom.getDescription() != null) {
479  0 setLocationWithinModule(context + ".getDescription()");
480  0 accept(axiom.getDescription());
481    }
482  668 setLocationWithinModule(context);
483  668 visitor.visitLeave(axiom);
484  668 setLocationWithinModule(context);
485    }
486   
 
487  25051 toggle public void accept(final PredicateDefinition definition)
488    throws ModuleDataException {
489  25051 if (blocked || definition == null) {
490  22661 return;
491    }
492  2390 final String context = getCurrentContext().getLocationWithinModule();
493  2390 visitor.visitEnter(definition);
494  2176 if (definition.getVariableList() != null) {
495  2056 setLocationWithinModule(context + ".getVariableList()");
496  2056 accept(definition.getVariableList());
497    }
498  1782 if (definition.getFormula() != null) {
499  1663 setLocationWithinModule(context + ".getFormula()");
500  1663 accept(definition.getFormula());
501    }
502  624 if (definition.getDescription() != null) {
503  0 setLocationWithinModule(context + ".getDescription()");
504  0 accept(definition.getDescription());
505    }
506  624 setLocationWithinModule(context);
507  624 visitor.visitLeave(definition);
508  624 setLocationWithinModule(context);
509    }
510   
 
511  22602 toggle public void accept(final FunctionDefinition definition) throws ModuleDataException {
512  22602 if (blocked || definition == null) {
513  20188 return;
514    }
515  2414 final String context = getCurrentContext().getLocationWithinModule();
516  2414 visitor.visitEnter(definition);
517  2222 if (definition.getVariableList() != null) {
518  1964 setLocationWithinModule(context + ".getVariableList()");
519  1964 accept(definition.getVariableList());
520    }
521  1928 if (definition.getTerm() != null) {
522  1928 setLocationWithinModule(context + ".getTerm()");
523  1928 accept(definition.getTerm());
524    }
525  394 if (definition.getDescription() != null) {
526  0 setLocationWithinModule(context + ".getDescription()");
527  0 accept(definition.getDescription());
528    }
529  394 setLocationWithinModule(context);
530  394 visitor.visitLeave(definition);
531  394 setLocationWithinModule(context);
532    }
533   
 
534  76240 toggle public void accept(final Proposition proposition) throws ModuleDataException {
535  76240 if (blocked || proposition == null) {
536  56475 return;
537    }
538  19765 final String context = getCurrentContext().getLocationWithinModule();
539  19765 visitor.visitEnter(proposition);
540  19419 if (proposition.getFormula() != null) {
541  19419 setLocationWithinModule(context + ".getFormula()");
542  19419 accept(proposition.getFormula());
543    }
544  1759 if (proposition.getDescription() != null) {
545  82 setLocationWithinModule(context + ".getDescription()");
546  82 accept(proposition.getDescription());
547    }
548  1745 if (proposition.getProofList() != null) {
549  536 setLocationWithinModule(context + ".getProofList()");
550  536 accept(proposition.getProofList());
551    }
552  1424 setLocationWithinModule(context);
553  1424 visitor.visitLeave(proposition);
554  1424 setLocationWithinModule(context);
555    }
556   
 
557  3993 toggle public void accept(final Rule rule) throws ModuleDataException {
558  3993 if (blocked || rule == null) {
559  3347 return;
560    }
561  646 final String context = getCurrentContext().getLocationWithinModule();
562  646 visitor.visitEnter(rule);
563  566 if (rule.getLinkList() != null) {
564  58 setLocationWithinModule(context + ".getLinkList()");
565  58 accept(rule.getLinkList());
566    }
567  558 if (rule.getDescription() != null) {
568  558 setLocationWithinModule(context + ".getDescription()");
569  558 accept(rule.getDescription());
570    }
571  444 if (rule.getProofList() != null) {
572  0 setLocationWithinModule(context + ".getProofList()");
573  0 accept(rule.getProofList());
574    }
575  444 setLocationWithinModule(context);
576  444 visitor.visitLeave(rule);
577  444 setLocationWithinModule(context);
578    }
579   
 
580  58 toggle public void accept(final LinkList linkList) throws ModuleDataException {
581  58 if (blocked || linkList == null) {
582  20 return;
583    }
584  38 final String context = getCurrentContext().getLocationWithinModule();
585  38 visitor.visitEnter(linkList);
586  30 setLocationWithinModule(context);
587  30 visitor.visitLeave(linkList);
588  30 setLocationWithinModule(context);
589    }
590   
 
591  4020 toggle public void accept(final VariableList variableList) throws ModuleDataException {
592  4020 if (blocked || variableList == null) {
593  228 return;
594    }
595  3792 final String context = getCurrentContext().getLocationWithinModule();
596  3792 visitor.visitEnter(variableList);
597  8790 for (int i = 0; i < variableList.size(); i++) {
598  5686 final String piece = context + ".get(" + i + ")";
599  5686 setLocationWithinModule(piece);
600  5686 if (variableList.get(i) != null) {
601  5686 if (variableList.get(i).isList()) {
602  5686 setLocationWithinModule(piece + ".getList()");
603  5686 accept(variableList.get(i).getList());
604  0 } else if (variableList.get(i).isAtom()) {
605  0 setLocationWithinModule(piece + ".getAtom()");
606  0 accept(variableList.get(i).getAtom());
607    } else {
608  0 throw new IllegalArgumentException("unexpected element type: "
609    + variableList.get(i).toString());
610    }
611    }
612    }
613  3104 setLocationWithinModule(context);
614  3104 visitor.visitLeave(variableList);
615  3104 setLocationWithinModule(context);
616    }
617   
 
618  536 toggle public void accept(final ProofList proofList) throws ModuleDataException {
619  536 if (blocked || proofList == null) {
620  76 return;
621    }
622  460 final String context = getCurrentContext().getLocationWithinModule();
623  460 visitor.visitEnter(proofList);
624  586 for (int i = 0; i < proofList.size(); i++) {
625  447 setLocationWithinModule(context + ".get(" + i + ")");
626  447 accept(proofList.get(i));
627    }
628  139 setLocationWithinModule(context);
629  139 visitor.visitLeave(proofList);
630  139 setLocationWithinModule(context);
631    }
632   
 
633  447 toggle public void accept(final Proof proof) throws ModuleDataException {
634  447 if (blocked || proof == null) {
635  0 return;
636    }
637  447 final String context = getCurrentContext().getLocationWithinModule();
638  447 visitor.visitEnter(proof);
639  324 if (proof.getNonFormalProof() != null) {
640  324 setLocationWithinModule(context + ".getNonFormalProof()");
641  324 accept(proof.getNonFormalProof());
642    }
643  180 setLocationWithinModule(context);
644  180 visitor.visitLeave(proof);
645  180 setLocationWithinModule(context);
646    }
647   
 
648  23995 toggle public void accept(final Formula formula) throws ModuleDataException {
649  23995 if (blocked || formula == null) {
650  820 return;
651    }
652  23175 final String context = getCurrentContext().getLocationWithinModule();
653  23175 visitor.visitEnter(formula);
654  22639 if (formula.getElement() != null) {
655  22639 setLocationWithinModule(context + ".getElement()");
656  22639 accept(formula.getElement());
657    }
658  2112 setLocationWithinModule(context);
659  2112 visitor.visitLeave(formula);
660  2112 setLocationWithinModule(context);
661    }
662   
 
663  1928 toggle public void accept(final Term term) throws ModuleDataException {
664  1928 if (blocked || term == null) {
665  96 return;
666    }
667  1832 final String context = getCurrentContext().getLocationWithinModule();
668  1832 visitor.visitEnter(term);
669  1736 if (term.getElement() != null) {
670  1736 setLocationWithinModule(context + ".getElement()");
671  1736 accept(term.getElement());
672    }
673  298 setLocationWithinModule(context);
674  298 visitor.visitLeave(term);
675  298 setLocationWithinModule(context);
676    }
677   
 
678  483231 toggle public void accept(final Element element) throws ModuleDataException {
679  483231 if (blocked || element == null) {
680  215870 return;
681    }
682  267361 final String context = getCurrentContext().getLocationWithinModule();
683  267361 if (element.isList()) {
684  222822 setLocationWithinModule(context + ".getList()");
685  222822 accept(element.getList());
686  44539 } else if (element.isAtom()) {
687  44539 setLocationWithinModule(context + ".getAtom()");
688  44539 accept(element.getAtom());
689    } else {
690  0 throw new IllegalArgumentException("unexpected element type: "
691    + element.toString());
692    }
693  186143 setLocationWithinModule(context);
694    }
695   
 
696  44539 toggle public void accept(final Atom atom) throws ModuleDataException {
697  44539 if (blocked || atom == null) {
698  0 return;
699    }
700  44539 final String context = getCurrentContext().getLocationWithinModule();
701  44539 visitor.visitEnter(atom);
702  44539 setLocationWithinModule(context);
703  44539 visitor.visitLeave(atom);
704  44539 setLocationWithinModule(context);
705    }
706   
 
707  228508 toggle public void accept(final ElementList list) throws ModuleDataException {
708  228508 if (blocked || list == null) {
709  4006 return;
710    }
711  224502 final String context = getCurrentContext().getLocationWithinModule();
712  224502 visitor.visitEnter(list);
713  601614 for (int i = 0; i < list.size(); i++) {
714  458854 setLocationWithinModule(context + ".getElement(" + i + ")");
715  458854 accept(list.getElement(i));
716    }
717  142760 setLocationWithinModule(context);
718  142760 visitor.visitLeave(list);
719  142760 setLocationWithinModule(context);
720    }
721   
 
722  834576 toggle public void accept(final LatexList latexList) throws ModuleDataException {
723  834576 if (blocked || latexList == null) {
724  642845 return;
725    }
726  191731 final String context = getCurrentContext().getLocationWithinModule();
727  191731 visitor.visitEnter(latexList);
728  554515 for (int i = 0; i < latexList.size(); i++) {
729  368284 setLocationWithinModule(context + ".get(" + i + ")");
730  368284 accept(latexList.get(i));
731    }
732  186231 setLocationWithinModule(context);
733  186231 visitor.visitLeave(latexList);
734  186231 setLocationWithinModule(context);
735    }
736   
 
737  368707 toggle public void accept(final Latex latex) throws ModuleDataException {
738  368707 if (blocked || latex == null) {
739  346186 return;
740    }
741  22521 final String context = getCurrentContext().getLocationWithinModule();
742  22521 visitor.visitEnter(latex);
743  19624 setLocationWithinModule(context);
744  19624 visitor.visitLeave(latex);
745  19624 setLocationWithinModule(context);
746    }
747   
748    /**
749    * Set location information where are we within the original module.
750    *
751    * @param locationWithinModule Location within module.
752    */
 
753  5646939 toggle public void setLocationWithinModule(final String locationWithinModule) {
754  5646939 getCurrentContext().setLocationWithinModule(locationWithinModule);
755    }
756   
757    /**
758    * Get current context within original. Remember to use the copy constructor
759    * when trying to remember this context!
760    *
761    * @return Current context.
762    */
 
763  10894832 toggle public final ModuleContext getCurrentContext() {
764  10894832 return currentContext;
765    }
766   
767    /**
768    * Is further traversing blocked?
769    *
770    * @return Is further traversing blocked?
771    */
 
772  0 toggle public final boolean getBlocked() {
773  0 return blocked;
774    }
775   
776    /**
777    * Set if further transversing is blocked.
778    *
779    * @param blocked Further transversion?
780    */
 
781  1193423 toggle public final void setBlocked(final boolean blocked) {
782  1193423 this.blocked = blocked;
783    }
784   
785    }
786