Clover Coverage Report
Coverage timestamp: Thu Feb 13 2014 22:53:14 UTC
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
835   1,417   299   12.28
354   1,238   0.36   68
68     4.4  
1    
 
  QedeqNotNullTraverser       Line # 91 835 299 95.6% 0.956245
 
  (6)
 
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.se.visitor;
17   
18    import java.util.HashMap;
19    import java.util.Map;
20    import java.util.Stack;
21   
22    import org.qedeq.kernel.se.base.list.Atom;
23    import org.qedeq.kernel.se.base.list.Element;
24    import org.qedeq.kernel.se.base.list.ElementList;
25    import org.qedeq.kernel.se.base.module.Add;
26    import org.qedeq.kernel.se.base.module.Author;
27    import org.qedeq.kernel.se.base.module.AuthorList;
28    import org.qedeq.kernel.se.base.module.Axiom;
29    import org.qedeq.kernel.se.base.module.ChangedRule;
30    import org.qedeq.kernel.se.base.module.ChangedRuleList;
31    import org.qedeq.kernel.se.base.module.Chapter;
32    import org.qedeq.kernel.se.base.module.ChapterList;
33    import org.qedeq.kernel.se.base.module.Conclusion;
34    import org.qedeq.kernel.se.base.module.ConditionalProof;
35    import org.qedeq.kernel.se.base.module.Existential;
36    import org.qedeq.kernel.se.base.module.FormalProof;
37    import org.qedeq.kernel.se.base.module.FormalProofLine;
38    import org.qedeq.kernel.se.base.module.FormalProofLineList;
39    import org.qedeq.kernel.se.base.module.FormalProofList;
40    import org.qedeq.kernel.se.base.module.Formula;
41    import org.qedeq.kernel.se.base.module.FunctionDefinition;
42    import org.qedeq.kernel.se.base.module.Header;
43    import org.qedeq.kernel.se.base.module.Hypothesis;
44    import org.qedeq.kernel.se.base.module.Import;
45    import org.qedeq.kernel.se.base.module.ImportList;
46    import org.qedeq.kernel.se.base.module.InitialFunctionDefinition;
47    import org.qedeq.kernel.se.base.module.InitialPredicateDefinition;
48    import org.qedeq.kernel.se.base.module.Latex;
49    import org.qedeq.kernel.se.base.module.LatexList;
50    import org.qedeq.kernel.se.base.module.LinkList;
51    import org.qedeq.kernel.se.base.module.LiteratureItem;
52    import org.qedeq.kernel.se.base.module.LiteratureItemList;
53    import org.qedeq.kernel.se.base.module.Location;
54    import org.qedeq.kernel.se.base.module.LocationList;
55    import org.qedeq.kernel.se.base.module.ModusPonens;
56    import org.qedeq.kernel.se.base.module.Node;
57    import org.qedeq.kernel.se.base.module.PredicateDefinition;
58    import org.qedeq.kernel.se.base.module.Proof;
59    import org.qedeq.kernel.se.base.module.ProofList;
60    import org.qedeq.kernel.se.base.module.Proposition;
61    import org.qedeq.kernel.se.base.module.Qedeq;
62    import org.qedeq.kernel.se.base.module.Reason;
63    import org.qedeq.kernel.se.base.module.Rename;
64    import org.qedeq.kernel.se.base.module.Rule;
65    import org.qedeq.kernel.se.base.module.Section;
66    import org.qedeq.kernel.se.base.module.SectionList;
67    import org.qedeq.kernel.se.base.module.Specification;
68    import org.qedeq.kernel.se.base.module.Subsection;
69    import org.qedeq.kernel.se.base.module.SubsectionList;
70    import org.qedeq.kernel.se.base.module.SubstFree;
71    import org.qedeq.kernel.se.base.module.SubstFunc;
72    import org.qedeq.kernel.se.base.module.SubstPred;
73    import org.qedeq.kernel.se.base.module.Term;
74    import org.qedeq.kernel.se.base.module.Universal;
75    import org.qedeq.kernel.se.base.module.UsedByList;
76    import org.qedeq.kernel.se.common.ModuleAddress;
77    import org.qedeq.kernel.se.common.ModuleContext;
78    import org.qedeq.kernel.se.common.ModuleDataException;
79    import org.qedeq.kernel.se.common.RuleKey;
80    import org.qedeq.kernel.se.common.ServiceCompleteness;
81    import org.qedeq.kernel.se.dto.module.FormulaVo;
82    import org.qedeq.kernel.se.dto.module.TermVo;
83   
84   
85    /**
86    * Traverse QEDEQ module. Calls visitors of {@link org.qedeq.kernel.se.visitor.QedeqVisitor}
87    * for non <code>null</code> arguments.
88    *
89    * @author Michael Meyling
90    */
 
91    public class QedeqNotNullTraverser implements QedeqTraverser, ServiceCompleteness {
92   
93    /** Current context during creation. */
94    private final ModuleContext currentContext;
95   
96    /** Readable traverse location info. */
97    private final Stack location = new Stack();
98   
99    /** Herein are various counters for the current node. */
100    private QedeqNumbers data = new QedeqNumbers(0, 0);
101   
102    /** Converts chapter and other titles into text. */
103    private final LatexList2Text transform = new LatexList2Text();
104   
105    /**
106    * These methods are called if a node is visited. To start the whole process just call
107    * {@link #accept(Qedeq)}.
108    */
109    private QedeqVisitor visitor;
110   
111    /** Is sub node traverse currently blocked? */
112    private boolean blocked;
113   
114    /** Currently visited node element of QEDEQ module. Might be <code>null</code>. */
115    private Node node;
116   
117    /** Maps local {@link ruleName}s to local {@link RuleKey}s. */
118    private Map ruleExistence;
119   
120    /**
121    * Constructor.
122    *
123    * @param globalContext Module location information.
124    * @param visitor These methods are called if a node is visited.
125    */
 
126  9 toggle public QedeqNotNullTraverser(final ModuleAddress globalContext, final QedeqVisitor visitor) {
127  9 currentContext = globalContext.createModuleContext();
128  9 this.visitor = visitor;
129    }
130   
131    /**
132    * Constructor.
133    *
134    * @param globalContext Module location information.
135    */
 
136  1 toggle public QedeqNotNullTraverser(final ModuleAddress globalContext) {
137  1 currentContext = globalContext.createModuleContext();
138    }
139   
140    /**
141    * Set visitor.
142    *
143    * @param visitor These methods are called if a node is visited.
144    */
 
145  1 toggle public void setVisitor(final QedeqVisitor visitor) {
146  1 this.visitor = visitor;
147    }
148   
 
149  153 toggle public void accept(final Qedeq qedeq) throws ModuleDataException {
150  153 ruleExistence = new HashMap();
151  153 setLocation("started");
152  153 if (qedeq == null) {
153  1 throw new NullPointerException("null QEDEQ module");
154    }
155  152 data = new QedeqNumbers(
156  152 (qedeq.getHeader() != null && qedeq.getHeader().getImportList() != null
157    ? qedeq.getHeader().getImportList().size() : 0),
158  152 (qedeq.getChapterList() != null ? qedeq.getChapterList().size() : 0)
159    );
160  152 getCurrentContext().setLocationWithinModule("");
161  152 checkForInterrupt();
162  152 blocked = false;
163  152 final String context = getCurrentContext().getLocationWithinModule();
164  152 visitor.visitEnter(qedeq);
165  152 if (qedeq.getHeader() != null) {
166  20 getCurrentContext().setLocationWithinModule(context + "getHeader()");
167  20 accept(qedeq.getHeader());
168    }
169  152 if (qedeq.getChapterList() != null) {
170  127 getCurrentContext().setLocationWithinModule(context + "getChapterList()");
171  127 accept(qedeq.getChapterList());
172    }
173  152 if (qedeq.getLiteratureItemList() != null) {
174  4 getCurrentContext().setLocationWithinModule(context + "getLiteratureItemList()");
175  4 accept(qedeq.getLiteratureItemList());
176    }
177  152 setLocationWithinModule(context);
178  152 visitor.visitLeave(qedeq);
179  152 setLocationWithinModule(context);
180  152 setLocation("finished");
181  152 data.setFinished(true);
182    }
183   
184    /**
185    * Check if current thread is interrupted.
186    *
187    * @throws InterruptException We were interrupted.
188    */
 
189  1657 toggle private void checkForInterrupt() throws InterruptException {
190  1657 if (Thread.interrupted()) {
191  53 throw new InterruptException(getCurrentContext());
192    }
193    }
194   
 
195  22 toggle public void accept(final Header header) throws ModuleDataException {
196  22 checkForInterrupt();
197  21 if (blocked || header == null) {
198  1 return;
199    }
200  20 setLocation("analyzing header");
201  20 final String context = getCurrentContext().getLocationWithinModule();
202  20 visitor.visitEnter(header);
203  20 if (header.getSpecification() != null) {
204  3 setLocationWithinModule(context + ".getSpecification()");
205  3 accept(header.getSpecification());
206    }
207  20 if (header.getTitle() != null) {
208  2 setLocationWithinModule(context + ".getTitle()");
209  2 accept(header.getTitle());
210    }
211  20 if (header.getSummary() != null) {
212  2 setLocationWithinModule(context + ".getSummary()");
213  2 accept(header.getSummary());
214    }
215  20 if (header.getAuthorList() != null) {
216  3 setLocationWithinModule(context + ".getAuthorList()");
217  3 accept(header.getAuthorList());
218    }
219  20 if (header.getImportList() != null) {
220  5 setLocationWithinModule(context + ".getImportList()");
221  5 accept(header.getImportList());
222    }
223  20 if (header.getUsedByList() != null) {
224  4 setLocationWithinModule(context + ".getUsedByList()");
225  4 accept(header.getUsedByList());
226    }
227  20 setLocationWithinModule(context);
228  20 visitor.visitLeave(header);
229  20 setLocationWithinModule(context);
230    }
231   
 
232  6 toggle public void accept(final UsedByList usedByList) throws ModuleDataException {
233  6 checkForInterrupt();
234  5 if (blocked || usedByList == null) {
235  1 return;
236    }
237  4 location.push("working on used by list");
238  4 final String context = getCurrentContext().getLocationWithinModule();
239  4 visitor.visitEnter(usedByList);
240  7 for (int i = 0; i < usedByList.size(); i++) {
241  3 setLocationWithinModule(context + ".get(" + i + ")");
242  3 accept(usedByList.get(i));
243    }
244  4 setLocationWithinModule(context);
245  4 visitor.visitLeave(usedByList);
246  4 setLocationWithinModule(context);
247  4 location.pop();
248    }
249   
 
250  7 toggle public void accept(final ImportList importList) throws ModuleDataException {
251  7 checkForInterrupt();
252  6 if (blocked || importList == null) {
253  1 return;
254    }
255  5 location.push("working on import list");
256  5 final String context = getCurrentContext().getLocationWithinModule();
257  5 visitor.visitEnter(importList);
258  9 for (int i = 0; i < importList.size(); i++) {
259  4 setLocationWithinModule(context + ".get(" + i + ")");
260  4 accept(importList.get(i));
261    }
262  5 setLocationWithinModule(context);
263  5 visitor.visitLeave(importList);
264  5 setLocationWithinModule(context);
265  5 location.pop();
266    }
267   
 
268  6 toggle public void accept(final Import imp) throws ModuleDataException {
269  6 data.increaseImportNumber();
270  6 checkForInterrupt();
271  5 if (blocked || imp == null) {
272  1 return;
273    }
274  4 location.push("import " + data.getImportNumber() + ": " + imp.getLabel());
275  4 final String context = getCurrentContext().getLocationWithinModule();
276  4 visitor.visitEnter(imp);
277  4 if (imp.getSpecification() != null) {
278  3 setLocationWithinModule(context + ".getSpecification()");
279  3 accept(imp.getSpecification());
280    }
281  4 setLocationWithinModule(context);
282  4 visitor.visitLeave(imp);
283  4 setLocationWithinModule(context);
284  4 location.pop();
285    }
286   
 
287  11 toggle public void accept(final Specification specification) throws ModuleDataException {
288  11 checkForInterrupt();
289  10 if (blocked || specification == null) {
290  1 return;
291    }
292  9 final String context = getCurrentContext().getLocationWithinModule();
293  9 visitor.visitEnter(specification);
294  9 if (specification.getLocationList() != null) {
295  6 setLocationWithinModule(context + ".getLocationList()");
296  6 accept(specification.getLocationList());
297    }
298  9 setLocationWithinModule(context);
299  9 visitor.visitLeave(specification);
300  9 setLocationWithinModule(context);
301    }
302   
 
303  8 toggle public void accept(final LocationList locationList) throws ModuleDataException {
304  8 checkForInterrupt();
305  7 if (blocked || locationList == null) {
306  1 return;
307    }
308  6 final String context = getCurrentContext().getLocationWithinModule();
309  6 visitor.visitEnter(locationList);
310  9 for (int i = 0; i < locationList.size(); i++) {
311  3 setLocationWithinModule(context + ".get(" + i + ")");
312  3 accept(locationList.get(i));
313    }
314  6 setLocationWithinModule(context);
315  6 visitor.visitLeave(locationList);
316  6 setLocationWithinModule(context);
317    }
318   
 
319  5 toggle public void accept(final Location location) throws ModuleDataException {
320  5 checkForInterrupt();
321  4 if (blocked || location == null) {
322  1 return;
323    }
324  3 final String context = getCurrentContext().getLocationWithinModule();
325  3 visitor.visitEnter(location);
326  3 setLocationWithinModule(context);
327  3 visitor.visitLeave(location);
328  3 setLocationWithinModule(context);
329    }
330   
 
331  5 toggle public void accept(final AuthorList authorList) throws ModuleDataException {
332  5 checkForInterrupt();
333  4 if (blocked || authorList == null) {
334  1 return;
335    }
336  3 final String context = getCurrentContext().getLocationWithinModule();
337  3 visitor.visitEnter(authorList);
338  5 for (int i = 0; i < authorList.size(); i++) {
339  2 setLocationWithinModule(context + ".get(" + i + ")");
340  2 accept(authorList.get(i));
341    }
342  3 setLocationWithinModule(context);
343  3 visitor.visitLeave(authorList);
344  3 setLocationWithinModule(context);
345    }
346   
 
347  4 toggle public void accept(final Author author) throws ModuleDataException {
348  4 checkForInterrupt();
349  3 if (blocked || author == null) {
350  1 return;
351    }
352  2 final String context = getCurrentContext().getLocationWithinModule();
353  2 visitor.visitEnter(author);
354  2 if (author.getName() != null) {
355  1 setLocationWithinModule(context + ".getName()");
356  1 accept(author.getName());
357    }
358  2 setLocationWithinModule(context);
359  2 visitor.visitLeave(author);
360  2 setLocationWithinModule(context);
361    }
362   
 
363  129 toggle public void accept(final ChapterList chapterList) throws ModuleDataException {
364  129 checkForInterrupt();
365  128 if (blocked || chapterList == null) {
366  1 return;
367    }
368  127 final String context = getCurrentContext().getLocationWithinModule();
369  127 visitor.visitEnter(chapterList);
370  253 for (int i = 0; i < chapterList.size(); i++) {
371  126 setLocationWithinModule(context + ".get(" + i + ")");
372  126 accept(chapterList.get(i));
373    }
374  127 setLocationWithinModule(context);
375  127 visitor.visitLeave(chapterList);
376  127 setLocationWithinModule(context);
377    }
378   
 
379  128 toggle public void accept(final Chapter chapter) throws ModuleDataException {
380  128 checkForInterrupt();
381  127 if (blocked || chapter == null) {
382  1 return;
383    }
384  126 data.increaseChapterNumber(
385  126 (chapter.getSectionList() != null ? chapter.getSectionList().size() : 0),
386    chapter.getNoNumber() == null || !chapter.getNoNumber().booleanValue()
387    );
388  126 if (data.isChapterNumbering()) {
389  126 setLocation("Chapter " + data.getChapterNumber() + " "
390    + transform.transform(chapter.getTitle()));
391    } else {
392  0 setLocation(transform.transform(chapter.getTitle()));
393    }
394  126 final String context = getCurrentContext().getLocationWithinModule();
395  126 visitor.visitEnter(chapter);
396  126 if (chapter.getTitle() != null) {
397  2 setLocationWithinModule(context + ".getTitle()");
398  2 accept(chapter.getTitle());
399    }
400  126 if (chapter.getIntroduction() != null) {
401  2 setLocationWithinModule(context + ".getIntroduction()");
402  2 accept(chapter.getIntroduction());
403    }
404  126 if (chapter.getSectionList() != null) {
405  120 setLocationWithinModule(context + ".getSectionList()");
406  120 accept(chapter.getSectionList());
407    }
408  126 setLocationWithinModule(context);
409  126 visitor.visitLeave(chapter);
410  126 setLocationWithinModule(context);
411    }
412   
 
413  6 toggle public void accept(final LiteratureItemList literatureItemList)
414    throws ModuleDataException {
415  6 checkForInterrupt();
416  5 if (blocked || literatureItemList == null) {
417  1 return;
418    }
419  4 setLocation("working on literature list");
420  4 final String context = getCurrentContext().getLocationWithinModule();
421  4 visitor.visitEnter(literatureItemList);
422  7 for (int i = 0; i < literatureItemList.size(); i++) {
423  3 setLocationWithinModule(context + ".get(" + i + ")");
424  3 accept(literatureItemList.get(i));
425    }
426  4 setLocationWithinModule(context);
427  4 visitor.visitLeave(literatureItemList);
428  4 setLocationWithinModule(context);
429    }
430   
 
431  5 toggle public void accept(final LiteratureItem item) throws ModuleDataException {
432  5 checkForInterrupt();
433  4 if (blocked || item == null) {
434  1 return;
435    }
436  3 final String context = getCurrentContext().getLocationWithinModule();
437  3 visitor.visitEnter(item);
438  3 if (item.getItem() != null) {
439  2 setLocationWithinModule(context + ".getItem()");
440  2 accept(item.getItem());
441    }
442  3 setLocationWithinModule(context);
443  3 visitor.visitLeave(item);
444  3 setLocationWithinModule(context);
445    }
446   
 
447  122 toggle public void accept(final SectionList sectionList) throws ModuleDataException {
448  122 checkForInterrupt();
449  121 if (blocked || sectionList == null) {
450  1 return;
451    }
452  120 final String context = getCurrentContext().getLocationWithinModule();
453  120 visitor.visitEnter(sectionList);
454  239 for (int i = 0; i < sectionList.size(); i++) {
455  119 setLocationWithinModule(context + ".get(" + i + ")");
456  119 accept(sectionList.get(i));
457    }
458  120 setLocationWithinModule(context);
459  120 visitor.visitLeave(sectionList);
460  120 setLocationWithinModule(context);
461    }
462   
 
463  121 toggle public void accept(final Section section) throws ModuleDataException {
464  121 checkForInterrupt();
465  120 if (blocked || section == null) {
466  1 return;
467    }
468  119 data.increaseSectionNumber(
469  119 (section.getSubsectionList() != null ? section.getSubsectionList().size() : 0),
470    section.getNoNumber() == null || !section.getNoNumber().booleanValue()
471    );
472  119 String title = "";
473  119 if (data.isChapterNumbering()) {
474  119 title += data.getChapterNumber();
475    }
476  119 if (data.isSectionNumbering()) {
477  119 title += (title.length() > 0 ? "." : "") + data.getSectionNumber();
478    }
479  119 if (section.getTitle() != null) {
480  2 title += " " + transform.transform(section.getTitle());
481    }
482  119 location.push(title);
483  119 final String context = getCurrentContext().getLocationWithinModule();
484  119 visitor.visitEnter(section);
485  119 if (section.getTitle() != null) {
486  2 setLocationWithinModule(context + ".getTitle()");
487  2 accept(section.getTitle());
488    }
489  119 if (section.getIntroduction() != null) {
490  2 setLocationWithinModule(context + ".getIntroduction()");
491  2 accept(section.getIntroduction());
492    }
493  119 if (section.getSubsectionList() != null) {
494  113 setLocationWithinModule(context + ".getSubsectionList()");
495  113 accept(section.getSubsectionList());
496    }
497  119 setLocationWithinModule(context);
498  119 visitor.visitLeave(section);
499  119 setLocationWithinModule(context);
500  119 location.pop();
501    }
502   
 
503  115 toggle public void accept(final SubsectionList subsectionList) throws ModuleDataException {
504  115 checkForInterrupt();
505  114 if (blocked || subsectionList == null) {
506  1 return;
507    }
508  113 final String context = getCurrentContext().getLocationWithinModule();
509  113 visitor.visitEnter(subsectionList);
510  225 for (int i = 0; i < subsectionList.size(); i++) {
511  112 setLocationWithinModule(context + ".get(" + i + ")");
512    // TODO 20130131 m31: variation here hard coded
513    // 20050608: here the Subsection context is type dependently specified
514  112 if (subsectionList.get(i) instanceof Subsection) {
515  5 setLocationWithinModule(context + ".get(" + i + ").getSubsection()");
516  5 accept((Subsection) subsectionList.get(i));
517  107 } else if (subsectionList.get(i) instanceof Node) {
518  107 setLocationWithinModule(context + ".get(" + i + ").getNode()");
519  107 accept((Node) subsectionList.get(i));
520  0 } else if (subsectionList.get(i) == null) {
521    // ignore
522    } else {
523  0 throw new IllegalArgumentException("unexpected subsection type: "
524    + subsectionList.get(i).getClass());
525    }
526    }
527  113 setLocationWithinModule(context);
528  113 visitor.visitLeave(subsectionList);
529  113 setLocationWithinModule(context);
530    }
531   
 
532  7 toggle public void accept(final Subsection subsection) throws ModuleDataException {
533  7 checkForInterrupt();
534  6 if (blocked || subsection == null) {
535  1 return;
536    }
537  5 data.increaseSubsectionNumber();
538  5 String title = "";
539  5 if (data.isChapterNumbering()) {
540  5 title += data.getChapterNumber();
541    }
542  5 if (data.isSectionNumbering()) {
543  5 title += (title.length() > 0 ? "." : "") + data.getSectionNumber();
544    }
545  5 title += (title.length() > 0 ? "." : "") + data.getSubsectionNumber();
546  5 if (subsection.getTitle() != null) {
547  2 title += " " + transform.transform(subsection.getTitle());
548    }
549  5 title = title + " [" + subsection.getId() + "]";
550  5 location.push(title);
551  5 final String context = getCurrentContext().getLocationWithinModule();
552  5 visitor.visitEnter(subsection);
553  5 if (subsection.getTitle() != null) {
554  2 setLocationWithinModule(context + ".getTitle()");
555  2 accept(subsection.getTitle());
556    }
557  5 if (subsection.getLatex() != null) {
558  2 setLocationWithinModule(context + ".getLatex()");
559  2 accept(subsection.getLatex());
560    }
561  5 setLocationWithinModule(context);
562  5 visitor.visitLeave(subsection);
563  5 setLocationWithinModule(context);
564  5 location.pop();
565    }
566   
 
567  109 toggle public void accept(final Node node) throws ModuleDataException {
568  109 checkForInterrupt();
569  108 data.increaseNodeNumber();
570  108 if (blocked || node == null) {
571  1 return;
572    }
573  107 this.node = node;
574  107 String title = "";
575  107 if (node.getTitle() != null) {
576  2 title = transform.transform(node.getTitle());
577    }
578  107 title = title + " [" + node.getId() + "]";
579  107 location.push(title);
580  107 final String context = getCurrentContext().getLocationWithinModule();
581  107 visitor.visitEnter(node);
582  107 if (node.getName() != null) {
583  2 setLocationWithinModule(context + ".getName()");
584  2 accept(node.getName());
585    }
586  107 if (node.getTitle() != null) {
587  2 setLocationWithinModule(context + ".getTitle()");
588  2 accept(node.getTitle());
589    }
590  107 if (node.getPrecedingText() != null) {
591  2 setLocationWithinModule(context + ".getPrecedingText()");
592  2 accept(node.getPrecedingText());
593    }
594  107 if (node.getNodeType() != null) {
595  98 setLocationWithinModule(context + ".getNodeType()");
596  98 if (node.getNodeType() instanceof Axiom) {
597  6 setLocationWithinModule(context + ".getNodeType().getAxiom()");
598  6 accept((Axiom) node.getNodeType());
599  92 } else if (node.getNodeType() instanceof InitialPredicateDefinition) {
600  5 setLocationWithinModule(context + ".getNodeType().getInitialPredicateDefinition()");
601  5 accept((InitialPredicateDefinition) node.getNodeType());
602  87 } else if (node.getNodeType() instanceof PredicateDefinition) {
603  6 setLocationWithinModule(context + ".getNodeType().getPredicateDefinition()");
604  6 accept((PredicateDefinition) node.getNodeType());
605  81 } else if (node.getNodeType() instanceof InitialFunctionDefinition) {
606  5 setLocationWithinModule(context + ".getNodeType().getInitialFunctionDefinition()");
607  5 accept((InitialFunctionDefinition) node.getNodeType());
608  76 } else if (node.getNodeType() instanceof FunctionDefinition) {
609  6 setLocationWithinModule(context + ".getNodeType().getFunctionDefinition()");
610  6 accept((FunctionDefinition) node.getNodeType());
611  70 } else if (node.getNodeType() instanceof Proposition) {
612  58 setLocationWithinModule(context + ".getNodeType().getProposition()");
613  58 accept((Proposition) node.getNodeType());
614  12 } else if (node.getNodeType() instanceof Rule) {
615  12 setLocationWithinModule(context + ".getNodeType().getRule()");
616  12 accept((Rule) node.getNodeType());
617    } else {
618  0 throw new IllegalArgumentException("unexpected node type: "
619    + node.getNodeType().getClass());
620    }
621    }
622  107 if (node.getSucceedingText() != null) {
623  2 setLocationWithinModule(context + ".getSucceedingText()");
624  2 accept(node.getSucceedingText());
625    }
626  107 setLocationWithinModule(context);
627  107 visitor.visitLeave(node);
628  107 setLocationWithinModule(context);
629  107 location.pop();
630  107 this.node = null;
631    }
632   
 
633  8 toggle public void accept(final Axiom axiom) throws ModuleDataException {
634  8 checkForInterrupt();
635  7 if (blocked || axiom == null) {
636  1 return;
637    }
638  6 data.increaseAxiomNumber();
639  6 location.set(location.size() - 1, "Axiom " + data.getAxiomNumber() + " "
640    + (String) location.lastElement());
641  6 final String context = getCurrentContext().getLocationWithinModule();
642  6 visitor.visitEnter(axiom);
643  6 if (axiom.getFormula() != null) {
644  3 setLocationWithinModule(context + ".getFormula()");
645  3 accept(axiom.getFormula());
646    }
647  6 if (axiom.getDescription() != null) {
648  2 setLocationWithinModule(context + ".getDescription()");
649  2 accept(axiom.getDescription());
650    }
651  6 setLocationWithinModule(context);
652  6 visitor.visitLeave(axiom);
653  6 setLocationWithinModule(context);
654    }
655   
 
656  8 toggle public void accept(final PredicateDefinition definition)
657    throws ModuleDataException {
658  8 checkForInterrupt();
659  7 if (blocked || definition == null) {
660  1 return;
661    }
662  6 data.increasePredicateDefinitionNumber();
663  6 location.set(location.size() - 1, "Definition " + (data.getPredicateDefinitionNumber()
664    + data.getFunctionDefinitionNumber()) + " "
665    + (String) location.lastElement());
666  6 final String context = getCurrentContext().getLocationWithinModule();
667  6 visitor.visitEnter(definition);
668  6 if (definition.getFormula() != null) {
669  3 setLocationWithinModule(context + ".getFormula()");
670  3 accept(definition.getFormula());
671    }
672  6 if (definition.getDescription() != null) {
673  2 setLocationWithinModule(context + ".getDescription()");
674  2 accept(definition.getDescription());
675    }
676  6 setLocationWithinModule(context);
677  6 visitor.visitLeave(definition);
678  6 setLocationWithinModule(context);
679    }
680   
 
681  7 toggle public void accept(final InitialPredicateDefinition definition)
682    throws ModuleDataException {
683  7 checkForInterrupt();
684  6 if (blocked || definition == null) {
685  1 return;
686    }
687  5 data.increasePredicateDefinitionNumber();
688  5 location.set(location.size() - 1, "Definition "
689    + (data.getPredicateDefinitionNumber() + data
690    .getFunctionDefinitionNumber()) + " "
691    + (String) location.lastElement());
692  5 final String context = getCurrentContext().getLocationWithinModule();
693  5 visitor.visitEnter(definition);
694  5 if (definition.getPredCon() != null) {
695  2 setLocationWithinModule(context + ".getPredCon()");
696  2 accept(definition.getPredCon());
697    }
698  5 if (definition.getDescription() != null) {
699  2 setLocationWithinModule(context + ".getDescription()");
700  2 accept(definition.getDescription());
701    }
702  5 setLocationWithinModule(context);
703  5 visitor.visitLeave(definition);
704  5 setLocationWithinModule(context);
705    }
706   
 
707  7 toggle public void accept(final InitialFunctionDefinition definition) throws ModuleDataException {
708  7 checkForInterrupt();
709  6 if (blocked || definition == null) {
710  1 return;
711    }
712  5 data.increaseFunctionDefinitionNumber();
713  5 location.set(location.size() - 1, "Definition " + (data.getFunctionDefinitionNumber()
714    + data.getFunctionDefinitionNumber()) + " "
715    + (String) location.lastElement());
716  5 final String context = getCurrentContext().getLocationWithinModule();
717  5 visitor.visitEnter(definition);
718  5 if (definition.getFunCon() != null) {
719  2 setLocationWithinModule(context + ".getFunCon()");
720  2 accept(definition.getFunCon());
721    }
722  5 if (definition.getDescription() != null) {
723  2 setLocationWithinModule(context + ".getDescription()");
724  2 accept(definition.getDescription());
725    }
726  5 setLocationWithinModule(context);
727  5 visitor.visitLeave(definition);
728  5 setLocationWithinModule(context);
729    }
730   
 
731  8 toggle public void accept(final FunctionDefinition definition) throws ModuleDataException {
732  8 checkForInterrupt();
733  7 if (blocked || definition == null) {
734  1 return;
735    }
736  6 data.increaseFunctionDefinitionNumber();
737  6 location.set(location.size() - 1, "Definition " + (data.getFunctionDefinitionNumber()
738    + data.getFunctionDefinitionNumber()) + " "
739    + (String) location.lastElement());
740  6 final String context = getCurrentContext().getLocationWithinModule();
741  6 visitor.visitEnter(definition);
742  6 if (definition.getFormula() != null) {
743  3 setLocationWithinModule(context + ".getFormula()");
744  3 accept(definition.getFormula());
745    }
746  6 if (definition.getDescription() != null) {
747  2 setLocationWithinModule(context + ".getDescription()");
748  2 accept(definition.getDescription());
749    }
750  6 setLocationWithinModule(context);
751  6 visitor.visitLeave(definition);
752  6 setLocationWithinModule(context);
753    }
754   
 
755  60 toggle public void accept(final Proposition proposition) throws ModuleDataException {
756  60 checkForInterrupt();
757  59 if (blocked || proposition == null) {
758  1 return;
759    }
760  58 data.increasePropositionNumber();
761  58 location.set(location.size() - 1, "Proposition " + data.getPropositionNumber() + " "
762    + (String) location.lastElement());
763  58 final String context = getCurrentContext().getLocationWithinModule();
764  58 visitor.visitEnter(proposition);
765  58 if (proposition.getFormula() != null) {
766  3 setLocationWithinModule(context + ".getFormula()");
767  3 accept(proposition.getFormula());
768    }
769  58 if (proposition.getDescription() != null) {
770  2 setLocationWithinModule(context + ".getDescription()");
771  2 accept(proposition.getDescription());
772    }
773  58 if (proposition.getProofList() != null) {
774  4 setLocationWithinModule(context + ".getProofList()");
775  4 accept(proposition.getProofList());
776    }
777  58 if (proposition.getFormalProofList() != null) {
778  48 setLocationWithinModule(context + ".getFormalProofList()");
779  48 accept(proposition.getFormalProofList());
780    }
781  58 setLocationWithinModule(context);
782  58 visitor.visitLeave(proposition);
783  58 setLocationWithinModule(context);
784    }
785   
 
786  14 toggle public void accept(final Rule rule) throws ModuleDataException {
787  14 checkForInterrupt();
788  13 if (blocked || rule == null) {
789  1 return;
790    }
791  12 data.increaseRuleNumber();
792  12 location.set(location.size() - 1, "Rule " + data.getRuleNumber() + " "
793    + (String) location.lastElement());
794  12 final String context = getCurrentContext().getLocationWithinModule();
795  12 visitor.visitEnter(rule);
796  12 if (rule.getLinkList() != null) {
797  1 setLocationWithinModule(context + ".getLinkList()");
798  1 accept(rule.getLinkList());
799    }
800  12 if (rule.getDescription() != null) {
801  2 setLocationWithinModule(context + ".getDescription()");
802  2 accept(rule.getDescription());
803    }
804  12 if (rule.getChangedRuleList() != null) {
805  4 setLocationWithinModule(context + ".getChangedRuleList()");
806  4 accept(rule.getChangedRuleList());
807    }
808  12 if (rule.getProofList() != null) {
809  4 setLocationWithinModule(context + ".getProofList()");
810  4 accept(rule.getProofList());
811    }
812  12 setLocationWithinModule(context);
813  12 visitor.visitLeave(rule);
814  12 setLocationWithinModule(context);
815  12 final RuleKey newRuleKey = new RuleKey(rule.getName(), rule.getVersion());
816  12 ruleExistence.put(rule.getName(), newRuleKey);
817    }
818   
 
819  6 toggle public void accept(final ChangedRuleList list) throws ModuleDataException {
820  6 checkForInterrupt();
821  5 if (blocked || list == null) {
822  1 return;
823    }
824  4 final String context = getCurrentContext().getLocationWithinModule();
825  4 visitor.visitEnter(list);
826  4 setLocationWithinModule(context);
827  7 for (int i = 0; i < list.size(); i++) {
828  3 setLocationWithinModule(context + ".get(" + i + ")");
829  3 accept(list.get(i));
830    }
831  4 setLocationWithinModule(context);
832  4 visitor.visitLeave(list);
833  4 setLocationWithinModule(context);
834    }
835   
 
836  5 toggle public void accept(final ChangedRule rule) throws ModuleDataException {
837  5 checkForInterrupt();
838  4 if (blocked || rule == null) {
839  1 return;
840    }
841  3 data.increaseRuleNumber();
842  3 location.set(location.size() - 1, "Rule " + data.getRuleNumber() + " "
843    + (String) location.lastElement());
844  3 final String context = getCurrentContext().getLocationWithinModule();
845  3 visitor.visitEnter(rule);
846  3 if (rule.getDescription() != null) {
847  2 setLocationWithinModule(context + ".getDescription()");
848  2 accept(rule.getDescription());
849    }
850  3 setLocationWithinModule(context);
851  3 visitor.visitLeave(rule);
852  3 setLocationWithinModule(context);
853  3 final RuleKey newRuleKey = new RuleKey(rule.getName(), rule.getVersion());
854  3 ruleExistence.put(rule.getName(), newRuleKey);
855    }
856   
 
857  3 toggle public void accept(final LinkList linkList) throws ModuleDataException {
858  3 checkForInterrupt();
859  2 if (blocked || linkList == null) {
860  1 return;
861    }
862  1 final String context = getCurrentContext().getLocationWithinModule();
863  1 visitor.visitEnter(linkList);
864  1 setLocationWithinModule(context);
865  1 visitor.visitLeave(linkList);
866  1 setLocationWithinModule(context);
867    }
868   
 
869  10 toggle public void accept(final ProofList proofList) throws ModuleDataException {
870  10 checkForInterrupt();
871  9 if (blocked || proofList == null) {
872  1 return;
873    }
874  8 final String context = getCurrentContext().getLocationWithinModule();
875  8 visitor.visitEnter(proofList);
876  14 for (int i = 0; i < proofList.size(); i++) {
877  6 setLocationWithinModule(context + ".get(" + i + ")");
878  6 accept(proofList.get(i));
879    }
880  8 setLocationWithinModule(context);
881  8 visitor.visitLeave(proofList);
882  8 setLocationWithinModule(context);
883    }
884   
 
885  8 toggle public void accept(final Proof proof) throws ModuleDataException {
886  8 checkForInterrupt();
887  7 if (blocked || proof == null) {
888  1 return;
889    }
890  6 final String context = getCurrentContext().getLocationWithinModule();
891  6 visitor.visitEnter(proof);
892  6 if (proof.getNonFormalProof() != null) {
893  4 setLocationWithinModule(context + ".getNonFormalProof()");
894  4 accept(proof.getNonFormalProof());
895    }
896  6 setLocationWithinModule(context);
897  6 visitor.visitLeave(proof);
898  6 setLocationWithinModule(context);
899    }
900   
 
901  50 toggle public void accept(final FormalProofList proofList) throws ModuleDataException {
902  50 checkForInterrupt();
903  49 if (blocked || proofList == null) {
904  1 return;
905    }
906  48 final String context = getCurrentContext().getLocationWithinModule();
907  48 visitor.visitEnter(proofList);
908  95 for (int i = 0; i < proofList.size(); i++) {
909  47 setLocationWithinModule(context + ".get(" + i + ")");
910  47 accept(proofList.get(i));
911    }
912  48 setLocationWithinModule(context);
913  48 visitor.visitLeave(proofList);
914  48 setLocationWithinModule(context);
915    }
916   
 
917  49 toggle public void accept(final FormalProof proof) throws ModuleDataException {
918  49 checkForInterrupt();
919  48 if (blocked || proof == null) {
920  1 return;
921    }
922  47 final String context = getCurrentContext().getLocationWithinModule();
923  47 visitor.visitEnter(proof);
924  47 if (proof.getPrecedingText() != null) {
925  2 setLocationWithinModule(context + ".getPrecedingText()");
926  2 accept(proof.getFormalProofLineList());
927    }
928  47 if (proof.getFormalProofLineList() != null) {
929  42 setLocationWithinModule(context + ".getFormalProofLineList()");
930  42 accept(proof.getFormalProofLineList());
931    }
932  47 if (proof.getSucceedingText() != null) {
933  2 setLocationWithinModule(context + ".getSucceedingText()");
934  2 accept(proof.getFormalProofLineList());
935    }
936  47 setLocationWithinModule(context);
937  47 visitor.visitLeave(proof);
938  47 setLocationWithinModule(context);
939    }
940   
 
941  48 toggle public void accept(final FormalProofLineList proofLineList) throws ModuleDataException {
942  48 checkForInterrupt();
943  47 if (blocked || proofLineList == null) {
944  5 return;
945    }
946  42 final String context = getCurrentContext().getLocationWithinModule();
947  42 visitor.visitEnter(proofLineList);
948  83 for (int i = 0; i < proofLineList.size(); i++) {
949  41 setLocationWithinModule(context + ".get(" + i + ")");
950  41 if (proofLineList.get(i) instanceof ConditionalProof) {
951  9 accept((ConditionalProof) proofLineList.get(i));
952    } else {
953  32 accept(proofLineList.get(i));
954    }
955    }
956  42 setLocationWithinModule(context);
957  42 visitor.visitLeave(proofLineList);
958  42 setLocationWithinModule(context);
959    }
960   
 
961  34 toggle public void accept(final FormalProofLine proofLine) throws ModuleDataException {
962  34 checkForInterrupt();
963  33 if (blocked || proofLine == null) {
964  1 return;
965    }
966  32 final String context = getCurrentContext().getLocationWithinModule();
967  32 visitor.visitEnter(proofLine);
968  32 if (proofLine.getFormula() != null) {
969  3 setLocationWithinModule(context + ".getFormula()");
970  3 accept(proofLine.getFormula());
971    }
972  32 if (proofLine.getReason() != null) {
973  28 setLocationWithinModule(context + ".getReason()");
974  28 accept(proofLine.getReason());
975    }
976  32 setLocationWithinModule(context);
977  32 visitor.visitLeave(proofLine);
978  32 setLocationWithinModule(context);
979    }
980   
 
981  30 toggle public void accept(final Reason reason) throws ModuleDataException {
982  30 checkForInterrupt();
983  29 if (blocked || reason == null) {
984  1 return;
985    }
986  28 final String context = getCurrentContext().getLocationWithinModule();
987  28 visitor.visitEnter(reason);
988  28 if (reason instanceof ModusPonens) {
989  1 setLocationWithinModule(context + ".getModusPonens()");
990  1 accept(((ModusPonens) reason).getModusPonens());
991  27 } else if (reason instanceof Add) {
992  1 setLocationWithinModule(context + ".getAdd()");
993  1 accept(((Add) reason).getAdd());
994  26 } else if (reason instanceof Rename) {
995  5 setLocationWithinModule(context + ".getRename()");
996  5 accept(((Rename) reason).getRename());
997  21 } else if (reason instanceof SubstFree) {
998  5 setLocationWithinModule(context + ".getSubstFree()");
999  5 accept(((SubstFree) reason).getSubstFree());
1000  16 } else if (reason instanceof SubstFunc) {
1001  5 setLocationWithinModule(context + ".getSubstFunc()");
1002  5 accept(((SubstFunc) reason).getSubstFunc());
1003  11 } else if (reason instanceof SubstPred) {
1004  5 setLocationWithinModule(context + ".getSubstPred()");
1005  5 accept(((SubstPred) reason).getSubstPred());
1006  6 } else if (reason instanceof Existential) {
1007  3 setLocationWithinModule(context + ".getExistential()");
1008  3 accept(((Existential) reason).getExistential());
1009  3 } else if (reason instanceof Universal) {
1010  3 setLocationWithinModule(context + ".getUniversal()");
1011  3 accept(((Universal) reason).getUniversal());
1012  0 } else if (reason instanceof ConditionalProof) {
1013  0 throw new IllegalArgumentException(
1014    "proof line shall not have a conditional proof as a reason, instead the proof line "
1015    + "itself should be the conditional proof!");
1016    } else {
1017  0 throw new IllegalArgumentException("unexpected reason type: "
1018    + reason.getClass());
1019    }
1020  28 setLocationWithinModule(context);
1021  28 visitor.visitLeave(reason);
1022  28 setLocationWithinModule(context);
1023    }
1024   
 
1025  3 toggle public void accept(final ModusPonens reason) throws ModuleDataException {
1026  3 checkForInterrupt();
1027  2 if (blocked || reason == null) {
1028  1 return;
1029    }
1030  1 final String context = getCurrentContext().getLocationWithinModule();
1031  1 visitor.visitEnter(reason);
1032  1 setLocationWithinModule(context);
1033  1 visitor.visitLeave(reason);
1034  1 setLocationWithinModule(context);
1035    }
1036   
 
1037  3 toggle public void accept(final Add reason) throws ModuleDataException {
1038  3 checkForInterrupt();
1039  2 if (blocked || reason == null) {
1040  1 return;
1041    }
1042  1 final String context = getCurrentContext().getLocationWithinModule();
1043  1 visitor.visitEnter(reason);
1044  1 setLocationWithinModule(context);
1045  1 visitor.visitLeave(reason);
1046  1 setLocationWithinModule(context);
1047    }
1048   
 
1049  7 toggle public void accept(final Rename reason) throws ModuleDataException {
1050  7 checkForInterrupt();
1051  6 if (blocked || reason == null) {
1052  1 return;
1053    }
1054  5 final String context = getCurrentContext().getLocationWithinModule();
1055  5 visitor.visitEnter(reason);
1056  5 if (reason.getOriginalSubjectVariable() != null) {
1057  2 setLocationWithinModule(context + ".getOriginalSubjectVariable()");
1058  2 accept(reason.getOriginalSubjectVariable());
1059    }
1060  5 if (reason.getReplacementSubjectVariable() != null) {
1061  2 setLocationWithinModule(context + ".getReplacementSubjectVariable()");
1062  2 accept(reason.getReplacementSubjectVariable());
1063    }
1064  5 setLocationWithinModule(context);
1065  5 visitor.visitLeave(reason);
1066  5 setLocationWithinModule(context);
1067    }
1068   
 
1069  7 toggle public void accept(final SubstFree reason) throws ModuleDataException {
1070  7 checkForInterrupt();
1071  6 if (blocked || reason == null) {
1072  1 return;
1073    }
1074  5 final String context = getCurrentContext().getLocationWithinModule();
1075  5 visitor.visitEnter(reason);
1076  5 if (reason.getSubjectVariable() != null) {
1077  2 setLocationWithinModule(context + ".getSubjectVariable()");
1078  2 accept(reason.getSubjectVariable());
1079    }
1080  5 if (reason.getSubstituteTerm() != null) {
1081  2 setLocationWithinModule(context + ".getSubstituteTerm()");
1082  2 accept(new TermVo(reason.getSubstituteTerm()));
1083    }
1084  5 setLocationWithinModule(context);
1085  5 visitor.visitLeave(reason);
1086  5 setLocationWithinModule(context);
1087    }
1088   
 
1089  7 toggle public void accept(final SubstFunc reason) throws ModuleDataException {
1090  7 checkForInterrupt();
1091  6 if (blocked || reason == null) {
1092  1 return;
1093    }
1094  5 final String context = getCurrentContext().getLocationWithinModule();
1095  5 visitor.visitEnter(reason);
1096  5 if (reason.getFunctionVariable() != null) {
1097  2 setLocationWithinModule(context + ".getFunctionVariable()");
1098  2 accept(reason.getFunctionVariable());
1099    }
1100  5 if (reason.getSubstituteTerm() != null) {
1101  2 setLocationWithinModule(context + ".getSubstituteTerm()");
1102  2 accept(new TermVo(reason.getSubstituteTerm()));
1103    }
1104  5 setLocationWithinModule(context);
1105  5 visitor.visitLeave(reason);
1106  5 setLocationWithinModule(context);
1107    }
1108   
 
1109  7 toggle public void accept(final SubstPred reason) throws ModuleDataException {
1110  7 checkForInterrupt();
1111  6 if (blocked || reason == null) {
1112  1 return;
1113    }
1114  5 final String context = getCurrentContext().getLocationWithinModule();
1115  5 visitor.visitEnter(reason);
1116  5 if (reason.getPredicateVariable() != null) {
1117  2 setLocationWithinModule(context + ".getPredicateVariable()");
1118  2 accept(reason.getPredicateVariable());
1119    }
1120  5 if (reason.getSubstituteFormula() != null) {
1121  2 setLocationWithinModule(context + ".getSubstituteFormula()");
1122  2 accept(new FormulaVo(reason.getSubstituteFormula()));
1123    }
1124  5 setLocationWithinModule(context);
1125  5 visitor.visitLeave(reason);
1126  5 setLocationWithinModule(context);
1127    }
1128   
 
1129  5 toggle public void accept(final Existential reason) throws ModuleDataException {
1130  5 checkForInterrupt();
1131  4 if (blocked || reason == null) {
1132  1 return;
1133    }
1134  3 final String context = getCurrentContext().getLocationWithinModule();
1135  3 visitor.visitEnter(reason);
1136  3 if (reason.getSubjectVariable() != null) {
1137  2 setLocationWithinModule(context + ".getSubjectVariable()");
1138  2 accept(reason.getSubjectVariable());
1139    }
1140  3 setLocationWithinModule(context);
1141  3 visitor.visitLeave(reason);
1142  3 setLocationWithinModule(context);
1143    }
1144   
 
1145  5 toggle public void accept(final Universal reason) throws ModuleDataException {
1146  5 checkForInterrupt();
1147  4 if (blocked || reason == null) {
1148  1 return;
1149    }
1150  3 final String context = getCurrentContext().getLocationWithinModule();
1151  3 visitor.visitEnter(reason);
1152  3 if (reason.getSubjectVariable() != null) {
1153  2 setLocationWithinModule(context + ".getSubjectVariable()");
1154  2 accept(reason.getSubjectVariable());
1155    }
1156  3 setLocationWithinModule(context);
1157  3 visitor.visitLeave(reason);
1158  3 setLocationWithinModule(context);
1159    }
1160   
 
1161  11 toggle public void accept(final ConditionalProof reason) throws ModuleDataException {
1162  11 checkForInterrupt();
1163  10 if (blocked || reason == null) {
1164  1 return;
1165    }
1166  9 final String context = getCurrentContext().getLocationWithinModule();
1167  9 visitor.visitEnter(reason);
1168  9 if (reason.getHypothesis() != null) {
1169  4 setLocationWithinModule(context + ".getHypothesis()");
1170  4 accept(reason.getHypothesis());
1171    }
1172  9 if (reason.getFormalProofLineList() != null) {
1173  0 setLocationWithinModule(context + ".getFormalProofLineList()");
1174  0 accept(reason.getFormalProofLineList());
1175    }
1176  9 if (reason.getConclusion() != null) {
1177  4 setLocationWithinModule(context + ".getConclusion()");
1178  4 accept(reason.getConclusion());
1179    }
1180  9 setLocationWithinModule(context);
1181  9 visitor.visitLeave(reason);
1182  9 setLocationWithinModule(context);
1183    }
1184   
 
1185  6 toggle public void accept(final Hypothesis hypothesis) throws ModuleDataException {
1186  6 checkForInterrupt();
1187  5 if (blocked || hypothesis == null) {
1188  1 return;
1189    }
1190  4 final String context = getCurrentContext().getLocationWithinModule();
1191  4 visitor.visitEnter(hypothesis);
1192  4 if (hypothesis.getFormula() != null) {
1193  3 setLocationWithinModule(context + ".getFormula()");
1194  3 accept(hypothesis.getFormula());
1195    }
1196  4 setLocationWithinModule(context);
1197  4 visitor.visitLeave(hypothesis);
1198  4 setLocationWithinModule(context);
1199    }
1200   
 
1201  6 toggle public void accept(final Conclusion conclusion) throws ModuleDataException {
1202  6 checkForInterrupt();
1203  5 if (blocked || conclusion == null) {
1204  1 return;
1205    }
1206  4 final String context = getCurrentContext().getLocationWithinModule();
1207  4 visitor.visitEnter(conclusion);
1208  4 if (conclusion.getFormula() != null) {
1209  3 setLocationWithinModule(context + ".getFormula()");
1210  3 accept(conclusion.getFormula());
1211    }
1212  4 setLocationWithinModule(context);
1213  4 visitor.visitLeave(conclusion);
1214  4 setLocationWithinModule(context);
1215    }
1216   
 
1217  25 toggle public void accept(final Formula formula) throws ModuleDataException {
1218  25 checkForInterrupt();
1219  24 if (blocked || formula == null) {
1220  1 return;
1221    }
1222  23 final String context = getCurrentContext().getLocationWithinModule();
1223  23 visitor.visitEnter(formula);
1224  23 if (formula.getElement() != null) {
1225  16 setLocationWithinModule(context + ".getElement()");
1226  16 accept(formula.getElement());
1227    }
1228  23 setLocationWithinModule(context);
1229  23 visitor.visitLeave(formula);
1230  23 setLocationWithinModule(context);
1231    }
1232   
 
1233  6 toggle public void accept(final Term term) throws ModuleDataException {
1234  6 checkForInterrupt();
1235  5 if (blocked || term == null) {
1236  1 return;
1237    }
1238  4 final String context = getCurrentContext().getLocationWithinModule();
1239  4 visitor.visitEnter(term);
1240  4 if (term.getElement() != null) {
1241  4 setLocationWithinModule(context + ".getElement()");
1242  4 accept(term.getElement());
1243    }
1244  4 setLocationWithinModule(context);
1245  4 visitor.visitLeave(term);
1246  4 setLocationWithinModule(context);
1247    }
1248   
 
1249  80 toggle public void accept(final Element element) throws ModuleDataException {
1250  80 checkForInterrupt();
1251  79 if (blocked || element == null) {
1252  1 return;
1253    }
1254  78 final String context = getCurrentContext().getLocationWithinModule();
1255  78 if (element.isList()) {
1256  40 setLocationWithinModule(context + ".getList()");
1257  40 accept(element.getList());
1258  38 } else if (element.isAtom()) {
1259  38 setLocationWithinModule(context + ".getAtom()");
1260  38 accept(element.getAtom());
1261    } else {
1262  0 throw new IllegalArgumentException("unexpected element type: "
1263    + element.toString());
1264    }
1265  78 setLocationWithinModule(context);
1266    }
1267   
 
1268  40 toggle public void accept(final Atom atom) throws ModuleDataException {
1269  40 checkForInterrupt();
1270  39 if (blocked || atom == null) {
1271  1 return;
1272    }
1273  38 final String context = getCurrentContext().getLocationWithinModule();
1274  38 visitor.visitEnter(atom);
1275  38 setLocationWithinModule(context);
1276  38 visitor.visitLeave(atom);
1277  38 setLocationWithinModule(context);
1278    }
1279   
 
1280  42 toggle public void accept(final ElementList list) throws ModuleDataException {
1281  42 checkForInterrupt();
1282  41 if (blocked || list == null) {
1283  1 return;
1284    }
1285  40 final String context = getCurrentContext().getLocationWithinModule();
1286  40 visitor.visitEnter(list);
1287  78 for (int i = 0; i < list.size(); i++) {
1288  38 setLocationWithinModule(context + ".getElement(" + i + ")");
1289  38 accept(list.getElement(i));
1290    }
1291  40 setLocationWithinModule(context);
1292  40 visitor.visitLeave(list);
1293  40 setLocationWithinModule(context);
1294    }
1295   
 
1296  48 toggle public void accept(final LatexList latexList) throws ModuleDataException {
1297  48 checkForInterrupt();
1298  47 if (blocked || latexList == null) {
1299  1 return;
1300    }
1301  46 final String context = getCurrentContext().getLocationWithinModule();
1302  46 visitor.visitEnter(latexList);
1303  69 for (int i = 0; i < latexList.size(); i++) {
1304  23 setLocationWithinModule(context + ".get(" + i + ")");
1305  23 accept(latexList.get(i));
1306    }
1307  46 setLocationWithinModule(context);
1308  46 visitor.visitLeave(latexList);
1309  46 setLocationWithinModule(context);
1310    }
1311   
 
1312  26 toggle public void accept(final Latex latex) throws ModuleDataException {
1313  26 checkForInterrupt();
1314  25 if (blocked || latex == null) {
1315  1 return;
1316    }
1317  24 final String context = getCurrentContext().getLocationWithinModule();
1318  24 visitor.visitEnter(latex);
1319  24 setLocationWithinModule(context);
1320  24 visitor.visitLeave(latex);
1321  24 setLocationWithinModule(context);
1322    }
1323   
1324    /**
1325    * Get node that is currently parsed. Might be <code>null</code>.
1326    *
1327    * @return QEDEQ node were are currently in.
1328    */
 
1329  0 toggle public Node getNode() {
1330  0 return node;
1331    }
1332   
1333    /**
1334    * Set location information where are we within the original module.
1335    *
1336    * @param locationWithinModule Location within module.
1337    */
 
1338  4476 toggle public void setLocationWithinModule(final String locationWithinModule) {
1339  4476 getCurrentContext().setLocationWithinModule(locationWithinModule);
1340    }
1341   
 
1342  9287 toggle public final ModuleContext getCurrentContext() {
1343  9287 return currentContext;
1344    }
1345   
1346    /**
1347    * Is further traversing blocked?
1348    *
1349    * @return Is further traversing blocked?
1350    */
 
1351  0 toggle public final boolean getBlocked() {
1352  0 return blocked;
1353    }
1354   
1355    /**
1356    * Set if further traverse is blocked.
1357    *
1358    * @param blocked Further transversion?
1359    */
 
1360  0 toggle public final void setBlocked(final boolean blocked) {
1361  0 this.blocked = blocked;
1362    }
1363   
1364    /**
1365    * Get calculated visit percentage.
1366    *
1367    * @return Value between 0 and 100.
1368    */
 
1369  0 toggle public double getVisitPercentage() {
1370  0 if (data == null) {
1371  0 return 0;
1372    }
1373  0 return data.getVisitPercentage();
1374    }
1375   
1376    /**
1377    * Set absolute location description.
1378    *
1379    * @param text Description.
1380    */
 
1381  455 toggle private void setLocation(final String text) {
1382  455 location.setSize(0);
1383  455 location.push(text);
1384    }
1385   
 
1386  0 toggle public String getLocationDescription() {
1387  0 final StringBuffer buffer = new StringBuffer();
1388  0 for (int i = 0; i < location.size(); i++) {
1389  0 if (i > 0) {
1390  0 buffer.append(" / ");
1391    }
1392  0 buffer.append(location.get(i));
1393    }
1394  0 return buffer.toString();
1395    }
1396   
1397    /**
1398    * Get copy of current counters.
1399    *
1400    * @return Values of various counters.
1401    */
 
1402  0 toggle public QedeqNumbers getCurrentNumbers() {
1403  0 return new QedeqNumbers(data);
1404    }
1405   
1406    /**
1407    * Get current (QEDEQ module local) rule version for given rule name.
1408    *
1409    * @param name Rule name
1410    * @return Current (local) rule version. Might be <code>null</code>.
1411    */
 
1412  0 toggle public RuleKey getLocalRuleKey(final String name) {
1413  0 return (RuleKey) ruleExistence.get(name);
1414    }
1415   
1416    }
1417