Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mrz 27 2008 21:46:26 CET
file stats: LOC: 786   Methods: 40
NCLOC: 679   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
QedeqNotNullTraverser.java 79,1% 94,2% 97,5% 89,9%
coverage coverage
 1    /* $Id: QedeqNotNullTraverser.java,v 1.2 2008/03/27 05:16:27 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.bo.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.bo.visitor.QedeqVisitor}
 62    * for non <code>null</code> arguments.
 63    *
 64    * @version $Revision: 1.2 $
 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  32831 public QedeqNotNullTraverser(final ModuleAddress globalContext, final QedeqVisitor visitor) {
 88  32831 currentContext = globalContext.createModuleContext();
 89  32831 this.visitor = visitor;
 90    }
 91   
 92  32829 public void accept(final Qedeq qedeq) throws ModuleDataException {
 93  32829 getCurrentContext().setLocationWithinModule("");
 94  32829 blocked = false;
 95  32829 if (qedeq == null) {
 96  0 throw new NullPointerException("null QEDEQ module");
 97    }
 98  32829 final String context = getCurrentContext().getLocationWithinModule();
 99  32829 visitor.visitEnter(qedeq);
 100  32827 if (qedeq.getHeader() != null) {
 101  32827 getCurrentContext().setLocationWithinModule(context + "getHeader()");
 102  32827 accept(qedeq.getHeader());
 103    }
 104  32322 if (qedeq.getChapterList() != null) {
 105  32322 getCurrentContext().setLocationWithinModule(context + "getChapterList()");
 106  32322 accept(qedeq.getChapterList());
 107    }
 108  621 if (qedeq.getLiteratureItemList() != null) {
 109  256 getCurrentContext().setLocationWithinModule(context + "getLiteratureItemList()");
 110  256 accept(qedeq.getLiteratureItemList());
 111    }
 112  451 setLocationWithinModule(context);
 113  451 visitor.visitLeave(qedeq);
 114  451 setLocationWithinModule(context);
 115    }
 116   
 117  32827 public void accept(final Header header) throws ModuleDataException {
 118  32827 if (blocked || header == null) {
 119  0 return;
 120    }
 121  32827 final String context = getCurrentContext().getLocationWithinModule();
 122  32827 visitor.visitEnter(header);
 123  32803 if (header.getSpecification() != null) {
 124  32803 setLocationWithinModule(context + ".getSpecification()");
 125  32803 accept(header.getSpecification());
 126    }
 127  32698 if (header.getTitle() != null) {
 128  32698 setLocationWithinModule(context + ".getTitle()");
 129  32698 accept(header.getTitle());
 130    }
 131  32652 if (header.getSummary() != null) {
 132  32652 setLocationWithinModule(context + ".getSummary()");
 133  32652 accept(header.getSummary());
 134    }
 135  32606 if (header.getAuthorList() != null) {
 136  32606 setLocationWithinModule(context + ".getAuthorList()");
 137  32606 accept(header.getAuthorList());
 138    }
 139  32534 if (header.getImportList() != null) {
 140  24541 setLocationWithinModule(context + ".getImportList()");
 141  24541 accept(header.getImportList());
 142    }
 143  32377 if (header.getUsedByList() != null) {
 144  8040 setLocationWithinModule(context + ".getUsedByList()");
 145  8040 accept(header.getUsedByList());
 146    }
 147  32322 setLocationWithinModule(context);
 148  32322 visitor.visitLeave(header);
 149  32322 setLocationWithinModule(context);
 150    }
 151   
 152  8040 public void accept(final UsedByList usedByList) throws ModuleDataException {
 153  8040 if (blocked || usedByList == null) {
 154  7858 return;
 155    }
 156  182 final String context = getCurrentContext().getLocationWithinModule();
 157  182 visitor.visitEnter(usedByList);
 158  172 for (int i = 0; i < usedByList.size(); i++) {
 159  172 setLocationWithinModule(context + ".get(" + i + ")");
 160  172 accept(usedByList.get(i));
 161    }
 162  127 setLocationWithinModule(context);
 163  127 visitor.visitLeave(usedByList);
 164  127 setLocationWithinModule(context);
 165    }
 166   
 167  24541 public void accept(final ImportList importList) throws ModuleDataException {
 168  24541 if (blocked || importList == null) {
 169  24062 return;
 170    }
 171  479 final String context = getCurrentContext().getLocationWithinModule();
 172  479 visitor.visitEnter(importList);
 173  467 for (int i = 0; i < importList.size(); i++) {
 174  671 setLocationWithinModule(context + ".get(" + i + ")");
 175  671 accept(importList.get(i));
 176    }
 177  322 setLocationWithinModule(context);
 178  322 visitor.visitLeave(importList);
 179  322 setLocationWithinModule(context);
 180    }
 181   
 182  671 public void accept(final Import imp) throws ModuleDataException {
 183  671 if (blocked || imp == null) {
 184  44 return;
 185    }
 186  627 final String context = getCurrentContext().getLocationWithinModule();
 187  627 visitor.visitEnter(imp);
 188  556 if (imp.getSpecification() != null) {
 189  556 setLocationWithinModule(context + ".getSpecification()");
 190  556 accept(imp.getSpecification());
 191    }
 192  482 setLocationWithinModule(context);
 193  482 visitor.visitLeave(imp);
 194  482 setLocationWithinModule(context);
 195    }
 196   
 197  33531 public void accept(final Specification specification) throws ModuleDataException {
 198  33531 if (blocked || specification == null) {
 199  31883 return;
 200    }
 201  1648 final String context = getCurrentContext().getLocationWithinModule();
 202  1648 visitor.visitEnter(specification);
 203  1556 if (specification.getLocationList() != null) {
 204  1556 setLocationWithinModule(context + ".getLocationList()");
 205  1556 accept(specification.getLocationList());
 206    }
 207  1424 setLocationWithinModule(context);
 208  1424 visitor.visitLeave(specification);
 209  1424 setLocationWithinModule(context);
 210    }
 211   
 212  1556 public void accept(final LocationList locationList) throws ModuleDataException {
 213  1556 if (blocked || locationList == null) {
 214  376 return;
 215    }
 216  1180 final String context = getCurrentContext().getLocationWithinModule();
 217  1180 visitor.visitEnter(locationList);
 218  1132 for (int i = 0; i < locationList.size(); i++) {
 219  1350 setLocationWithinModule(context + ".get(" + i + ")");
 220  1350 accept(locationList.get(i));
 221    }
 222  1048 setLocationWithinModule(context);
 223  1048 visitor.visitLeave(locationList);
 224  1048 setLocationWithinModule(context);
 225    }
 226   
 227  1350 public void accept(final Location location) throws ModuleDataException {
 228  1350 if (blocked || location == null) {
 229  0 return;
 230    }
 231  1350 final String context = getCurrentContext().getLocationWithinModule();
 232  1350 visitor.visitEnter(location);
 233  1266 setLocationWithinModule(context);
 234  1266 visitor.visitLeave(location);
 235  1266 setLocationWithinModule(context);
 236    }
 237   
 238  32606 public void accept(final AuthorList authorList) throws ModuleDataException {
 239  32606 if (blocked || authorList == null) {
 240  31849 return;
 241    }
 242  757 final String context = getCurrentContext().getLocationWithinModule();
 243  757 visitor.visitEnter(authorList);
 244  733 for (int i = 0; i < authorList.size(); i++) {
 245  733 setLocationWithinModule(context + ".get(" + i + ")");
 246  733 accept(authorList.get(i));
 247    }
 248  685 setLocationWithinModule(context);
 249  685 visitor.visitLeave(authorList);
 250  685 setLocationWithinModule(context);
 251    }
 252   
 253  733 public void accept(final Author author) throws ModuleDataException {
 254  733 if (blocked || author == null) {
 255  212 return;
 256    }
 257  521 final String context = getCurrentContext().getLocationWithinModule();
 258  521 visitor.visitEnter(author);
 259  486 if (author.getName() != null) {
 260  486 setLocationWithinModule(context + ".getName()");
 261  486 accept(author.getName());
 262    }
 263  473 setLocationWithinModule(context);
 264  473 visitor.visitLeave(author);
 265  473 setLocationWithinModule(context);
 266    }
 267   
 268  32322 public void accept(final ChapterList chapterList) throws ModuleDataException {
 269  32322 if (blocked || chapterList == null) {
 270  104 return;
 271    }
 272  32218 final String context = getCurrentContext().getLocationWithinModule();
 273  32218 visitor.visitEnter(chapterList);
 274  32205 for (int i = 0; i < chapterList.size(); i++) {
 275  142224 setLocationWithinModule(context + ".get(" + i + ")");
 276  142224 accept(chapterList.get(i));
 277    }
 278  517 setLocationWithinModule(context);
 279  517 visitor.visitLeave(chapterList);
 280  517 setLocationWithinModule(context);
 281    }
 282   
 283  142224 public void accept(final Chapter chapter) throws ModuleDataException {
 284  142224 if (blocked || chapter == null) {
 285  1260 return;
 286    }
 287  140964 final String context = getCurrentContext().getLocationWithinModule();
 288  140964 visitor.visitEnter(chapter);
 289  140821 if (chapter.getTitle() != null) {
 290  140821 setLocationWithinModule(context + ".getTitle()");
 291  140821 accept(chapter.getTitle());
 292    }
 293  140575 if (chapter.getIntroduction() != null) {
 294  140447 setLocationWithinModule(context + ".getIntroduction()");
 295  140447 accept(chapter.getIntroduction());
 296    }
 297  140337 if (chapter.getSectionList() != null) {
 298  72004 setLocationWithinModule(context + ".getSectionList()");
 299  72004 accept(chapter.getSectionList());
 300    }
 301  109276 setLocationWithinModule(context);
 302  109276 visitor.visitLeave(chapter);
 303  109276 setLocationWithinModule(context);
 304    }
 305   
 306  256 public void accept(final LiteratureItemList literatureItemList)
 307    throws ModuleDataException {
 308  256 if (blocked || literatureItemList == null) {
 309  6 return;
 310    }
 311  250 final String context = getCurrentContext().getLocationWithinModule();
 312  250 visitor.visitEnter(literatureItemList);
 313  244 for (int i = 0; i < literatureItemList.size(); i++) {
 314  972 setLocationWithinModule(context + ".get(" + i + ")");
 315  972 accept(literatureItemList.get(i));
 316    }
 317  80 setLocationWithinModule(context);
 318  80 visitor.visitLeave(literatureItemList);
 319  80 setLocationWithinModule(context);
 320    }
 321   
 322  972 public void accept(final LiteratureItem item) throws ModuleDataException {
 323  972 if (blocked || item == null) {
 324  0 return;
 325    }
 326  972 final String context = getCurrentContext().getLocationWithinModule();
 327  972 visitor.visitEnter(item);
 328  906 if (item.getItem() != null) {
 329  906 setLocationWithinModule(context + ".getItem()");
 330  906 accept(item.getItem());
 331    }
 332  808 setLocationWithinModule(context);
 333  808 visitor.visitLeave(item);
 334  808 setLocationWithinModule(context);
 335    }
 336   
 337  72004 public void accept(final SectionList sectionList) throws ModuleDataException {
 338  72004 if (blocked || sectionList == null) {
 339  40306 return;
 340    }
 341  31698 final String context = getCurrentContext().getLocationWithinModule();
 342  31698 visitor.visitEnter(sectionList);
 343  31622 for (int i = 0; i < sectionList.size(); i++) {
 344  76784 setLocationWithinModule(context + ".get(" + i + ")");
 345  76784 accept(sectionList.get(i));
 346    }
 347  637 setLocationWithinModule(context);
 348  637 visitor.visitLeave(sectionList);
 349  637 setLocationWithinModule(context);
 350    }
 351   
 352  76784 public void accept(final Section section) throws ModuleDataException {
 353  76784 if (blocked || section == null) {
 354  0 return;
 355    }
 356  76784 final String context = getCurrentContext().getLocationWithinModule();
 357  76784 visitor.visitEnter(section);
 358  76550 if (section.getTitle() != null) {
 359  76550 setLocationWithinModule(context + ".getTitle()");
 360  76550 accept(section.getTitle());
 361    }
 362  76070 if (section.getIntroduction() != null) {
 363  76028 setLocationWithinModule(context + ".getIntroduction()");
 364  76028 accept(section.getIntroduction());
 365    }
 366  75630 if (section.getSubsectionList() != null) {
 367  63947 setLocationWithinModule(context + ".getSubsectionList()");
 368  63947 accept(section.getSubsectionList());
 369    }
 370  45799 setLocationWithinModule(context);
 371  45799 visitor.visitLeave(section);
 372  45799 setLocationWithinModule(context);
 373    }
 374   
 375  63947 public void accept(final SubsectionList subsectionList) throws ModuleDataException {
 376  63947 if (blocked || subsectionList == null) {
 377  33148 return;
 378    }
 379  30799 final String context = getCurrentContext().getLocationWithinModule();
 380  30799 visitor.visitEnter(subsectionList);
 381  30669 for (int i = 0; i < subsectionList.size(); i++) {
 382  154724 setLocationWithinModule(context + ".get(" + i + ")");
 383    // TODO mime 20050608: here the Subsection context is type dependently specified
 384  154724 if (subsectionList.get(i) instanceof Subsection) {
 385  4376 accept((Subsection) subsectionList.get(i));
 386  150348 } else if (subsectionList.get(i) instanceof Node) {
 387  150348 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  968 setLocationWithinModule(context);
 396  968 visitor.visitLeave(subsectionList);
 397  968 setLocationWithinModule(context);
 398    }
 399   
 400  4376 public void accept(final Subsection subsection) throws ModuleDataException {
 401  4376 if (blocked || subsection == null) {
 402  0 return;
 403    }
 404  4376 final String context = getCurrentContext().getLocationWithinModule();
 405  4376 visitor.visitEnter(subsection);
 406  4274 if (subsection.getTitle() != null) {
 407  1964 setLocationWithinModule(context + ".getTitle()");
 408  1964 accept(subsection.getTitle());
 409    }
 410  4154 if (subsection.getLatex() != null) {
 411  4154 setLocationWithinModule(context + ".getLatex()");
 412  4154 accept(subsection.getLatex());
 413    }
 414  3988 setLocationWithinModule(context);
 415  3988 visitor.visitLeave(subsection);
 416  3988 setLocationWithinModule(context);
 417    }
 418   
 419  150348 public void accept(final Node node) throws ModuleDataException {
 420  150348 if (blocked || node == null) {
 421  0 return;
 422    }
 423  150348 final String context = getCurrentContext().getLocationWithinModule();
 424  150348 visitor.visitEnter(node);
 425  148959 if (node.getName() != null) {
 426  76173 setLocationWithinModule(context + ".getName()");
 427  76173 accept(node.getName());
 428    }
 429  148161 if (node.getTitle() != null) {
 430  75375 setLocationWithinModule(context + ".getTitle()");
 431  75375 accept(node.getTitle());
 432    }
 433  147363 if (node.getPrecedingText() != null) {
 434  143254 setLocationWithinModule(context + ".getPrecedingText()");
 435  143254 accept(node.getPrecedingText());
 436    }
 437  145909 if (node.getNodeType() != null) {
 438  145909 setLocationWithinModule(context + ".getNodeType()");
 439  145909 if (node.getNodeType() instanceof Axiom) {
 440  18558 setLocationWithinModule(context + ".getNodeType().getAxiom()");
 441  18558 accept((Axiom) node.getNodeType());
 442  127351 } else if (node.getNodeType() instanceof PredicateDefinition) {
 443  24987 setLocationWithinModule(context + ".getNodeType().getPredicateDefinition()");
 444  24987 accept((PredicateDefinition) node.getNodeType());
 445  102364 } else if (node.getNodeType() instanceof FunctionDefinition) {
 446  22490 setLocationWithinModule(context + ".getNodeType().getFunctionDefinition()");
 447  22490 accept((FunctionDefinition) node.getNodeType());
 448  79874 } else if (node.getNodeType() instanceof Proposition) {
 449  75802 setLocationWithinModule(context + ".getNodeType().getProposition()");
 450  75802 accept((Proposition) node.getNodeType());
 451  4072 } else if (node.getNodeType() instanceof Rule) {
 452  4072 setLocationWithinModule(context + ".getNodeType().getRule()");
 453  4072 accept((Rule) node.getNodeType());
 454    } else {
 455  0 throw new IllegalArgumentException("unexpected node type: "
 456    + node.getNodeType().getClass());
 457    }
 458    }
 459  121319 if (node.getSucceedingText() != null) {
 460  28437 setLocationWithinModule(context + ".getSucceedingText()");
 461  28437 accept(node.getSucceedingText());
 462    }
 463  121035 setLocationWithinModule(context);
 464  121035 visitor.visitLeave(node);
 465  121035 setLocationWithinModule(context);
 466    }
 467   
 468  18558 public void accept(final Axiom axiom) throws ModuleDataException {
 469  18558 if (blocked || axiom == null) {
 470  15455 return;
 471    }
 472  3103 final String context = getCurrentContext().getLocationWithinModule();
 473  3103 visitor.visitEnter(axiom);
 474  2978 if (axiom.getFormula() != null) {
 475  2978 setLocationWithinModule(context + ".getFormula()");
 476  2978 accept(axiom.getFormula());
 477    }
 478  729 if (axiom.getDescription() != null) {
 479  0 setLocationWithinModule(context + ".getDescription()");
 480  0 accept(axiom.getDescription());
 481    }
 482  729 setLocationWithinModule(context);
 483  729 visitor.visitLeave(axiom);
 484  729 setLocationWithinModule(context);
 485    }
 486   
 487  24987 public void accept(final PredicateDefinition definition)
 488    throws ModuleDataException {
 489  24987 if (blocked || definition == null) {
 490  22512 return;
 491    }
 492  2475 final String context = getCurrentContext().getLocationWithinModule();
 493  2475 visitor.visitEnter(definition);
 494  2261 if (definition.getVariableList() != null) {
 495  2129 setLocationWithinModule(context + ".getVariableList()");
 496  2129 accept(definition.getVariableList());
 497    }
 498  1867 if (definition.getFormula() != null) {
 499  1723 setLocationWithinModule(context + ".getFormula()");
 500  1723 accept(definition.getFormula());
 501    }
 502  709 if (definition.getDescription() != null) {
 503  0 setLocationWithinModule(context + ".getDescription()");
 504  0 accept(definition.getDescription());
 505    }
 506  709 setLocationWithinModule(context);
 507  709 visitor.visitLeave(definition);
 508  709 setLocationWithinModule(context);
 509    }
 510   
 511  22490 public void accept(final FunctionDefinition definition) throws ModuleDataException {
 512  22490 if (blocked || definition == null) {
 513  20108 return;
 514    }
 515  2382 final String context = getCurrentContext().getLocationWithinModule();
 516  2382 visitor.visitEnter(definition);
 517  2190 if (definition.getVariableList() != null) {
 518  1938 setLocationWithinModule(context + ".getVariableList()");
 519  1938 accept(definition.getVariableList());
 520    }
 521  1896 if (definition.getTerm() != null) {
 522  1896 setLocationWithinModule(context + ".getTerm()");
 523  1896 accept(definition.getTerm());
 524    }
 525  362 if (definition.getDescription() != null) {
 526  0 setLocationWithinModule(context + ".getDescription()");
 527  0 accept(definition.getDescription());
 528    }
 529  362 setLocationWithinModule(context);
 530  362 visitor.visitLeave(definition);
 531  362 setLocationWithinModule(context);
 532    }
 533   
 534  75802 public void accept(final Proposition proposition) throws ModuleDataException {
 535  75802 if (blocked || proposition == null) {
 536  56231 return;
 537    }
 538  19571 final String context = getCurrentContext().getLocationWithinModule();
 539  19571 visitor.visitEnter(proposition);
 540  19217 if (proposition.getFormula() != null) {
 541  19217 setLocationWithinModule(context + ".getFormula()");
 542  19217 accept(proposition.getFormula());
 543    }
 544  1553 if (proposition.getDescription() != null) {
 545  80 setLocationWithinModule(context + ".getDescription()");
 546  80 accept(proposition.getDescription());
 547    }
 548  1539 if (proposition.getProofList() != null) {
 549  344 setLocationWithinModule(context + ".getProofList()");
 550  344 accept(proposition.getProofList());
 551    }
 552  1343 setLocationWithinModule(context);
 553  1343 visitor.visitLeave(proposition);
 554  1343 setLocationWithinModule(context);
 555    }
 556   
 557  4072 public void accept(final Rule rule) throws ModuleDataException {
 558  4072 if (blocked || rule == null) {
 559  3356 return;
 560    }
 561  716 final String context = getCurrentContext().getLocationWithinModule();
 562  716 visitor.visitEnter(rule);
 563  636 if (rule.getLinkList() != null) {
 564  56 setLocationWithinModule(context + ".getLinkList()");
 565  56 accept(rule.getLinkList());
 566    }
 567  628 if (rule.getDescription() != null) {
 568  628 setLocationWithinModule(context + ".getDescription()");
 569  628 accept(rule.getDescription());
 570    }
 571  514 if (rule.getProofList() != null) {
 572  0 setLocationWithinModule(context + ".getProofList()");
 573  0 accept(rule.getProofList());
 574    }
 575  514 setLocationWithinModule(context);
 576  514 visitor.visitLeave(rule);
 577  514 setLocationWithinModule(context);
 578    }
 579   
 580  56 public void accept(final LinkList linkList) throws ModuleDataException {
 581  56 if (blocked || linkList == null) {
 582  20 return;
 583    }
 584  36 final String context = getCurrentContext().getLocationWithinModule();
 585  36 visitor.visitEnter(linkList);
 586  28 setLocationWithinModule(context);
 587  28 visitor.visitLeave(linkList);
 588  28 setLocationWithinModule(context);
 589    }
 590   
 591  4067 public void accept(final VariableList variableList) throws ModuleDataException {
 592  4067 if (blocked || variableList == null) {
 593  267 return;
 594    }
 595  3800 final String context = getCurrentContext().getLocationWithinModule();
 596  3800 visitor.visitEnter(variableList);
 597  3636 for (int i = 0; i < variableList.size(); i++) {
 598  5716 final String piece = context + ".get(" + i + ")";
 599  5716 setLocationWithinModule(piece);
 600  5716 if (variableList.get(i) != null) {
 601  5716 if (variableList.get(i).isList()) {
 602  5716 setLocationWithinModule(piece + ".getList()");
 603  5716 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  3112 setLocationWithinModule(context);
 614  3112 visitor.visitLeave(variableList);
 615  3112 setLocationWithinModule(context);
 616    }
 617   
 618  344 public void accept(final ProofList proofList) throws ModuleDataException {
 619  344 if (blocked || proofList == null) {
 620  51 return;
 621    }
 622  293 final String context = getCurrentContext().getLocationWithinModule();
 623  293 visitor.visitEnter(proofList);
 624  257 for (int i = 0; i < proofList.size(); i++) {
 625  257 setLocationWithinModule(context + ".get(" + i + ")");
 626  257 accept(proofList.get(i));
 627    }
 628  97 setLocationWithinModule(context);
 629  97 visitor.visitLeave(proofList);
 630  97 setLocationWithinModule(context);
 631    }
 632   
 633  257 public void accept(final Proof proof) throws ModuleDataException {
 634  257 if (blocked || proof == null) {
 635  0 return;
 636    }
 637  257 final String context = getCurrentContext().getLocationWithinModule();
 638  257 visitor.visitEnter(proof);
 639  182 if (proof.getNonFormalProof() != null) {
 640  182 setLocationWithinModule(context + ".getNonFormalProof()");
 641  182 accept(proof.getNonFormalProof());
 642    }
 643  97 setLocationWithinModule(context);
 644  97 visitor.visitLeave(proof);
 645  97 setLocationWithinModule(context);
 646    }
 647   
 648  23918 public void accept(final Formula formula) throws ModuleDataException {
 649  23918 if (blocked || formula == null) {
 650  902 return;
 651    }
 652  23016 final String context = getCurrentContext().getLocationWithinModule();
 653  23016 visitor.visitEnter(formula);
 654  22480 if (formula.getElement() != null) {
 655  22480 setLocationWithinModule(context + ".getElement()");
 656  22480 accept(formula.getElement());
 657    }
 658  1945 setLocationWithinModule(context);
 659  1945 visitor.visitLeave(formula);
 660  1945 setLocationWithinModule(context);
 661    }
 662   
 663  1896 public void accept(final Term term) throws ModuleDataException {
 664  1896 if (blocked || term == null) {
 665  96 return;
 666    }
 667  1800 final String context = getCurrentContext().getLocationWithinModule();
 668  1800 visitor.visitEnter(term);
 669  1704 if (term.getElement() != null) {
 670  1704 setLocationWithinModule(context + ".getElement()");
 671  1704 accept(term.getElement());
 672    }
 673  266 setLocationWithinModule(context);
 674  266 visitor.visitLeave(term);
 675  266 setLocationWithinModule(context);
 676    }
 677   
 678  480874 public void accept(final Element element) throws ModuleDataException {
 679  480874 if (blocked || element == null) {
 680  215758 return;
 681    }
 682  265116 final String context = getCurrentContext().getLocationWithinModule();
 683  265116 if (element.isList()) {
 684  221761 setLocationWithinModule(context + ".getList()");
 685  221761 accept(element.getList());
 686  43355 } else if (element.isAtom()) {
 687  43355 setLocationWithinModule(context + ".getAtom()");
 688  43355 accept(element.getAtom());
 689    } else {
 690  0 throw new IllegalArgumentException("unexpected element type: "
 691    + element.toString());
 692    }
 693  183884 setLocationWithinModule(context);
 694    }
 695   
 696  43355 public void accept(final Atom atom) throws ModuleDataException {
 697  43355 if (blocked || atom == null) {
 698  0 return;
 699    }
 700  43355 final String context = getCurrentContext().getLocationWithinModule();
 701  43355 visitor.visitEnter(atom);
 702  43355 setLocationWithinModule(context);
 703  43355 visitor.visitLeave(atom);
 704  43355 setLocationWithinModule(context);
 705    }
 706   
 707  227477 public void accept(final ElementList list) throws ModuleDataException {
 708  227477 if (blocked || list == null) {
 709  4006 return;
 710    }
 711  223471 final String context = getCurrentContext().getLocationWithinModule();
 712  223471 visitor.visitEnter(list);
 713  200974 for (int i = 0; i < list.size(); i++) {
 714  456688 setLocationWithinModule(context + ".getElement(" + i + ")");
 715  456688 accept(list.getElement(i));
 716    }
 717  141715 setLocationWithinModule(context);
 718  141715 visitor.visitLeave(list);
 719  141715 setLocationWithinModule(context);
 720    }
 721   
 722  830349 public void accept(final LatexList latexList) throws ModuleDataException {
 723  830349 if (blocked || latexList == null) {
 724  638654 return;
 725    }
 726  191695 final String context = getCurrentContext().getLocationWithinModule();
 727  191695 visitor.visitEnter(latexList);
 728  189110 for (int i = 0; i < latexList.size(); i++) {
 729  368514 setLocationWithinModule(context + ".get(" + i + ")");
 730  368514 accept(latexList.get(i));
 731    }
 732  186268 setLocationWithinModule(context);
 733  186268 visitor.visitLeave(latexList);
 734  186268 setLocationWithinModule(context);
 735    }
 736   
 737  369000 public void accept(final Latex latex) throws ModuleDataException {
 738  369000 if (blocked || latex == null) {
 739  343220 return;
 740    }
 741  25780 final String context = getCurrentContext().getLocationWithinModule();
 742  25780 visitor.visitEnter(latex);
 743  22925 setLocationWithinModule(context);
 744  22925 visitor.visitLeave(latex);
 745  22925 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  5622531 public void setLocationWithinModule(final String locationWithinModule) {
 754  5622531 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  10836185 public final ModuleContext getCurrentContext() {
 764  10836185 return currentContext;
 765    }
 766   
 767    /**
 768    * Is further traversing blocked?
 769    *
 770    * @return Is further traversing blocked?
 771    */
 772  0 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  1184054 public final void setBlocked(final boolean blocked) {
 782  1184054 this.blocked = blocked;
 783    }
 784   
 785    }
 786