Clover Coverage Report
Coverage timestamp: Fri Feb 14 2014 07:28:57 UTC
../../../../../../img/srcFileCovDistChart9.png 45% of files have more coverage
16   92   9   3.2
8   45   0.56   5
5     1.8  
1    
 
  UniversalHandler       Line # 32 16 9 86.2% 0.86206895
 
  (116)
 
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.xml.handler.module;
17   
18    import org.qedeq.kernel.se.base.list.Element;
19    import org.qedeq.kernel.se.base.module.Universal;
20    import org.qedeq.kernel.se.dto.module.UniversalVo;
21    import org.qedeq.kernel.xml.common.XmlSyntaxException;
22    import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
23    import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
24    import org.qedeq.kernel.xml.handler.list.ElementHandler;
25   
26   
27    /**
28    * Parse a existential generalization rule usage.
29    *
30    * @author Michael Meyling
31    */
 
32    public class UniversalHandler extends AbstractSimpleHandler {
33   
34    /** Rule value object. */
35    private Universal universal;
36   
37    /** Reference to previously proved formula. */
38    private String ref;
39   
40    /** Subject variable. */
41    private Element subjectVariable;
42   
43    /** Handle elements. */
44    private final ElementHandler elementHandler;
45   
46    /**
47    * Deals with definitions.
48    *
49    * @param handler Parent handler.
50    */
 
51  1230 toggle public UniversalHandler(final AbstractSimpleHandler handler) {
52  1230 super(handler, "UNIVERSAL");
53  1230 elementHandler = new ElementHandler(this);
54    }
55   
 
56  156 toggle public final void init() {
57  156 universal = null;
58  156 subjectVariable = null;
59  156 ref = null;
60    }
61   
62    /**
63    * Get rule object.
64    *
65    * @return Universal generalization usage.
66    */
 
67  156 toggle public final Universal getUniversalVo() {
68  156 return universal;
69    }
70   
 
71  279 toggle public final void startElement(final String name, final SimpleAttributes attributes)
72    throws XmlSyntaxException {
73  279 if (getStartTag().equals(name)) {
74  156 ref = attributes.getString("ref");
75  123 } else if ("VAR".equals(name)) {
76  123 changeHandler(elementHandler, name, attributes);
77    } else {
78  0 throw XmlSyntaxException.createUnexpectedTagException(name);
79    }
80    }
81   
 
82  279 toggle public final void endElement(final String name) throws XmlSyntaxException {
83  279 if (getStartTag().equals(name)) {
84  156 universal = new UniversalVo(ref, subjectVariable);
85  123 } else if ("VAR".equals(name)) {
86  123 subjectVariable = elementHandler.getElement();
87    } else {
88  0 throw XmlSyntaxException.createUnexpectedTagException(name);
89    }
90    }
91   
92    }