Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 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
 
  (101)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, 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  1064 toggle public UniversalHandler(final AbstractSimpleHandler handler) {
52  1064 super(handler, "UNIVERSAL");
53  1064 elementHandler = new ElementHandler(this);
54    }
55   
 
56  148 toggle public final void init() {
57  148 universal = null;
58  148 subjectVariable = null;
59  148 ref = null;
60    }
61   
62    /**
63    * Get rule object.
64    *
65    * @return Universal generalization usage.
66    */
 
67  148 toggle public final Universal getUniversalVo() {
68  148 return universal;
69    }
70   
 
71  263 toggle public final void startElement(final String name, final SimpleAttributes attributes)
72    throws XmlSyntaxException {
73  263 if (getStartTag().equals(name)) {
74  148 ref = attributes.getString("ref");
75  115 } else if ("VAR".equals(name)) {
76  115 changeHandler(elementHandler, name, attributes);
77    } else {
78  0 throw XmlSyntaxException.createUnexpectedTagException(name);
79    }
80    }
81   
 
82  263 toggle public final void endElement(final String name) throws XmlSyntaxException {
83  263 if (getStartTag().equals(name)) {
84  148 universal = new UniversalVo(ref, subjectVariable);
85  115 } else if ("VAR".equals(name)) {
86  115 subjectVariable = elementHandler.getElement();
87    } else {
88  0 throw XmlSyntaxException.createUnexpectedTagException(name);
89    }
90    }
91   
92    }