EMMA Coverage Report (generated Fri Feb 14 08:28:31 UTC 2014)
[all classes][org.qedeq.kernel.xml.handler.module]

COVERAGE SUMMARY FOR SOURCE FILE [SubstFuncvarHandler.java]

nameclass, %method, %block, %line, %
SubstFuncvarHandler.java100% (1/1)100% (5/5)95%  (115/121)92%  (24/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SubstFuncvarHandler100% (1/1)100% (5/5)95%  (115/121)92%  (24/26)
startElement (String, SimpleAttributes): void 100% (1/1)92%  (36/39)88%  (7/8)
endElement (String): void 100% (1/1)94%  (46/49)88%  (7/8)
SubstFuncvarHandler (AbstractSimpleHandler): void 100% (1/1)100% (17/17)100% (4/4)
getSubstFuncVo (): SubstFuncVo 100% (1/1)100% (3/3)100% (1/1)
init (): void 100% (1/1)100% (13/13)100% (5/5)

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 
16package org.qedeq.kernel.xml.handler.module;
17 
18import org.qedeq.kernel.se.base.list.Element;
19import org.qedeq.kernel.se.base.module.Term;
20import org.qedeq.kernel.se.dto.module.SubstFuncVo;
21import org.qedeq.kernel.xml.common.XmlSyntaxException;
22import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler;
23import org.qedeq.kernel.xml.handler.common.SimpleAttributes;
24import org.qedeq.kernel.xml.handler.list.ElementHandler;
25 
26 
27/**
28 * Parse a Substitute Function Variable Rule usage.
29 *
30 * @author  Michael Meyling
31 */
32public class SubstFuncvarHandler extends AbstractSimpleHandler {
33 
34    /** Rule value object. */
35    private SubstFuncVo substFunc;
36 
37    /** Reference to previously proved formula. */
38    private String ref;
39 
40    /** Function variable we want to substitute. */
41    private Element functionVariable;
42 
43    /** Replacement term. */
44    private Term substituteTerm;
45 
46    /** Handle terms. */
47    private final TermHandler termHandler;
48 
49    /** Handle elements. */
50    private final ElementHandler elementHandler;
51 
52    /**
53     * Deals with definitions.
54     *
55     * @param   handler Parent handler.
56     */
57    public SubstFuncvarHandler(final AbstractSimpleHandler handler) {
58        super(handler, "SUBST_FUNVAR");
59        termHandler = new TermHandler(this);
60        elementHandler = new ElementHandler(this);
61    }
62 
63    public final void init() {
64        substFunc = null;
65        substituteTerm = null;
66        functionVariable = null;
67        ref = null;
68    }
69 
70    /**
71     * Get Substitute Function Variable Rule usage.
72     *
73     * @return  Substitute Free Variable usage.
74     */
75    public final SubstFuncVo getSubstFuncVo() {
76        return substFunc;
77    }
78 
79    public final void startElement(final String name, final SimpleAttributes attributes)
80            throws XmlSyntaxException {
81        if (getStartTag().equals(name)) {
82            ref = attributes.getString("ref");
83        } else if ("FUNVAR".equals(name)) {
84            changeHandler(elementHandler, name, attributes);
85        } else if (termHandler.getStartTag().equals(name)) {
86            changeHandler(termHandler, name, attributes);
87        } else {
88            throw XmlSyntaxException.createUnexpectedTagException(name);
89        }
90    }
91 
92    public final void endElement(final String name) throws XmlSyntaxException {
93        if (getStartTag().equals(name)) {
94            substFunc = new SubstFuncVo(ref, functionVariable,
95                (substituteTerm != null ? substituteTerm.getElement() : null));
96        } else if ("FUNVAR".equals(name)) {
97            functionVariable = elementHandler.getElement();
98        } else if (termHandler.getStartTag().equals(name)) {
99            substituteTerm = termHandler.getTerm();
100        } else {
101            throw XmlSyntaxException.createUnexpectedTagException(name);
102        }
103    }
104 
105}

[all classes][org.qedeq.kernel.xml.handler.module]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov