Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../../../img/srcFileCovDistChart9.png 34% of files have more coverage
56   152   48   3.5
32   102   0.86   16
16     3  
1    
 
  AbstractFormulaChecker       Line # 29 56 48 82.7% 0.8269231
 
No Tests
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2010, 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.bo.logic.wf;
17   
18   
19   
20    import org.qedeq.base.test.QedeqTestCase;
21    import org.qedeq.base.trace.Trace;
22   
23    /**
24    * For testing the {@link org.qedeq.kernel.bo.logic.FormulaChecker}.
25    *
26    * @version $Revision: 1.1 $
27    * @author Michael Meyling
28    */
 
29    public abstract class AbstractFormulaChecker extends QedeqTestCase {
30   
31    /** This class. */
32    private static final Class CLASS = AbstractFormulaChecker.class;
33   
34   
35    private ExistenceChecker checker = new ExistenceChecker() {
36   
 
37  163 toggle public boolean predicateExists(final String name, final int arguments) {
38  163 Trace.param(CLASS, this, "predicateExists(String, int)", "name", name);
39  163 Trace.param(CLASS, this, "predicateExists(String, int)", "arguments", arguments);
40  163 if ("in".equals(name) && arguments == 2) {
41  24 return true;
42  139 } else if ("isSet".equals(name) && arguments == 1) {
43  3 return true;
44  136 } else if ("equal".equals(name) && arguments == 2) {
45  132 return true;
46  4 } else if ("true".equals(name) && arguments == 0) {
47  2 return true;
48    }
49  2 return false;
50    }
51   
 
52  0 toggle public boolean predicateExists(final Predicate predicate) {
53  0 return predicateExists(predicate.getName(), Integer.parseInt(predicate.getArguments()));
54    }
55   
 
56  10 toggle public boolean functionExists(final String name, final int arguments) {
57  10 Trace.param(CLASS, this, "functionExists(String, int)", "name", name);
58  10 Trace.param(CLASS, this, "functionExists(String, int)", "arguments", arguments);
59  10 if ("power".equals(name) && arguments == 1) {
60  3 return true;
61  7 } else if ("union".equals(name) && arguments == 2) {
62  4 return true;
63  3 } else if ("intersection".equals(name) && arguments == 2) {
64  0 return true;
65  3 } else if ("empty".equals(name) && arguments == 0) {
66  1 return true;
67    }
68  2 return false;
69    }
70   
 
71  0 toggle public boolean functionExists(Function function) {
72  0 return functionExists(function.getName(), Integer.parseInt(function.getArguments()));
73    }
74   
 
75  38 toggle public boolean classOperatorExists() {
76  38 return true;
77    }
78   
 
79  138 toggle public boolean identityOperatorExists() {
80  138 return true;
81    }
82   
 
83  125 toggle public String getIdentityOperator() {
84  125 return "equal";
85    }
86   
87    };
88   
89    private ExistenceChecker checkerWithoutClass = new ExistenceChecker() {
90   
 
91  53 toggle public boolean predicateExists(String name, int arguments) {
92  53 Trace.param(CLASS, this, "predicateExists(String, int)", "name", name);
93  53 Trace.param(CLASS, this, "predicateExists(String, int)", "arguments", arguments);
94  53 if ("in".equals(name) && arguments == 2) {
95  15 return true;
96  38 } else if ("isSet".equals(name) && arguments == 1) {
97  3 return true;
98  35 } else if ("equal".equals(name) && arguments == 2) {
99  33 return true;
100  2 } else if ("true".equals(name) && arguments == 0) {
101  2 return true;
102    }
103  0 return false;
104    }
105   
 
106  0 toggle public boolean predicateExists(Predicate predicate) {
107  0 return predicateExists(predicate.getName(), Integer.parseInt(predicate.getArguments()));
108    }
109   
 
110  2 toggle public boolean functionExists(String name, int arguments) {
111  2 Trace.param(CLASS, this, "functionExists(String, int)", "name", name);
112  2 Trace.param(CLASS, this, "functionExists(String, int)", "arguments", arguments);
113  2 if ("power".equals(name) && arguments == 1) {
114  1 return true;
115  1 } else if ("union".equals(name) && arguments == 2) {
116  0 return true;
117  1 } else if ("intersection".equals(name) && arguments == 2) {
118  0 return true;
119  1 } else if ("empty".equals(name) && arguments == 0) {
120  1 return true;
121    }
122  0 return false;
123    }
124   
 
125  0 toggle public boolean functionExists(Function function) {
126  0 return functionExists(function.getName(), Integer.parseInt(function.getArguments()));
127    }
128   
 
129  2 toggle public boolean classOperatorExists() {
130  2 return false;
131    }
132   
 
133  31 toggle public boolean identityOperatorExists() {
134  31 return true;
135    }
136   
 
137  29 toggle public String getIdentityOperator() {
138  29 return "equal";
139    }
140   
141    };
142   
 
143  125 toggle protected ExistenceChecker getChecker() {
144  125 return checker;
145    }
146   
 
147  29 toggle protected ExistenceChecker getCheckerWithoutClass() {
148  29 return checkerWithoutClass;
149    }
150   
151   
152    }