1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.bo.module; |
17 |
|
|
18 |
|
import org.qedeq.kernel.bo.common.NodeBo; |
19 |
|
import org.qedeq.kernel.bo.common.QedeqBo; |
20 |
|
import org.qedeq.kernel.se.base.list.Element; |
21 |
|
import org.qedeq.kernel.se.base.module.ConditionalProof; |
22 |
|
import org.qedeq.kernel.se.base.module.FormalProofLineList; |
23 |
|
import org.qedeq.kernel.se.base.module.FormalProofList; |
24 |
|
import org.qedeq.kernel.se.base.module.NodeType; |
25 |
|
import org.qedeq.kernel.se.base.module.Proposition; |
26 |
|
import org.qedeq.kernel.se.base.module.Reason; |
27 |
|
import org.qedeq.kernel.se.common.CheckLevel; |
28 |
|
import org.qedeq.kernel.se.common.ModuleContext; |
29 |
|
import org.qedeq.kernel.se.dto.module.NodeVo; |
30 |
|
import org.qedeq.kernel.se.visitor.QedeqNumbers; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@author |
36 |
|
|
|
|
| 76.2% |
Uncovered Elements: 29 (122) |
Complexity: 39 |
Complexity Density: 0.61 |
|
37 |
|
public class KernelNodeBo implements NodeBo, CheckLevel { |
38 |
|
|
39 |
|
|
40 |
|
private final NodeVo node; |
41 |
|
|
42 |
|
|
43 |
|
private final ModuleContext context; |
44 |
|
|
45 |
|
|
46 |
|
private final KernelQedeqBo qedeq; |
47 |
|
|
48 |
|
|
49 |
|
private final QedeqNumbers data; |
50 |
|
|
51 |
|
|
52 |
|
@link |
53 |
|
private int wellFormedCheck = UNCHECKED; |
54 |
|
|
55 |
|
|
56 |
|
@link |
57 |
|
private int provedCheck = UNCHECKED; |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
@param |
64 |
|
@param |
65 |
|
@param |
66 |
|
@param |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
68 |
19830
|
public KernelNodeBo(final NodeVo node, final ModuleContext context, final KernelQedeqBo qedeq,... |
69 |
|
final QedeqNumbers data) { |
70 |
19830
|
this.node = node; |
71 |
19830
|
this.context = new ModuleContext(context); |
72 |
19830
|
this.qedeq = qedeq; |
73 |
19830
|
this.data = new QedeqNumbers(data); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@return |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
18313
|
public NodeVo getNodeVo() {... |
82 |
18313
|
return node; |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
@return |
89 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
0
|
public ModuleContext getModuleContext() {... |
91 |
0
|
return context; |
92 |
|
} |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
@return |
98 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
0
|
public QedeqBo getParentQedeqBo() {... |
100 |
0
|
return qedeq; |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
@return |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
157
|
public KernelQedeqBo getQedeqBo() {... |
109 |
157
|
return qedeq; |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@return |
116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
117 |
2161
|
public QedeqNumbers getNumbers() {... |
118 |
2161
|
return data; |
119 |
|
} |
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
@param |
126 |
|
@return |
127 |
|
|
|
|
| 91.3% |
Uncovered Elements: 2 (23) |
Complexity: 7 |
Complexity Density: 0.54 |
|
128 |
7403
|
public boolean isProofLineLabel(final String label) {... |
129 |
7403
|
if (label == null || label.length() == 0) { |
130 |
0
|
return false; |
131 |
|
} |
132 |
7403
|
final Proposition theorem = getNodeVo().getNodeType().getProposition(); |
133 |
7403
|
if (theorem == null) { |
134 |
242
|
return false; |
135 |
|
} |
136 |
7161
|
final FormalProofList proofs = theorem.getFormalProofList(); |
137 |
7161
|
if (proofs == null) { |
138 |
840
|
return false; |
139 |
|
} |
140 |
|
|
141 |
7836
|
for (int i = 0; i < proofs.size(); i++) { |
142 |
6321
|
final FormalProofLineList list = proofs.get(i).getFormalProofLineList(); |
143 |
6321
|
if (hasProofLineLabel(label, list)) { |
144 |
4806
|
return true; |
145 |
|
} |
146 |
|
} |
147 |
|
|
148 |
1515
|
return false; |
149 |
|
} |
150 |
|
|
|
|
| 89.7% |
Uncovered Elements: 3 (29) |
Complexity: 8 |
Complexity Density: 0.53 |
|
151 |
10325
|
private boolean hasProofLineLabel(final String label, final FormalProofLineList list) {... |
152 |
10325
|
if (list == null) { |
153 |
0
|
return false; |
154 |
|
} |
155 |
60869
|
for (int j = 0; j < list.size(); j++) { |
156 |
56830
|
if (label.equals(list.get(j).getLabel())) { |
157 |
4186
|
return true; |
158 |
|
} |
159 |
52644
|
final Reason reason = list.get(j).getReason(); |
160 |
52644
|
if (reason instanceof ConditionalProof) { |
161 |
4624
|
final ConditionalProof conditionalProof = (ConditionalProof) reason; |
162 |
4624
|
if (conditionalProof.getHypothesis() != null) { |
163 |
4624
|
if (label.equals(conditionalProof.getHypothesis().getLabel())) { |
164 |
620
|
return true; |
165 |
|
} |
166 |
|
} |
167 |
4004
|
final FormalProofLineList list2 = conditionalProof.getFormalProofLineList(); |
168 |
4004
|
if (hasProofLineLabel(label, list2)) { |
169 |
1480
|
return true; |
170 |
|
} |
171 |
|
} |
172 |
|
} |
173 |
4039
|
return false; |
174 |
|
} |
175 |
|
|
176 |
|
|
177 |
|
@link |
178 |
|
|
179 |
|
@param |
180 |
|
@link |
181 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
182 |
21907
|
public void setWellFormed(final int wellFormedCheck) {... |
183 |
21907
|
this.wellFormedCheck = wellFormedCheck; |
184 |
|
} |
185 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
186 |
142
|
public boolean isWellFormed() {... |
187 |
142
|
return wellFormedCheck >= SUCCESS; |
188 |
|
} |
189 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
190 |
12743
|
public boolean isNotWellFormed() {... |
191 |
12743
|
return wellFormedCheck < SUCCESS && wellFormedCheck > UNCHECKED; |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
@link |
196 |
|
|
197 |
|
@param |
198 |
|
@link |
199 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
200 |
554
|
public void setProved(final int provedCheck) {... |
201 |
554
|
this.provedCheck = provedCheck; |
202 |
|
} |
203 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
204 |
944
|
public boolean isProved() {... |
205 |
944
|
return provedCheck >= SUCCESS; |
206 |
|
} |
207 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
208 |
83
|
public boolean isNotProved() {... |
209 |
83
|
return provedCheck < SUCCESS && provedCheck > UNCHECKED; |
210 |
|
} |
211 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
212 |
314
|
public boolean hasFormula() {... |
213 |
314
|
return null != getFormula(); |
214 |
|
} |
215 |
|
|
|
|
| 47.4% |
Uncovered Elements: 20 (38) |
Complexity: 11 |
Complexity Density: 0.55 |
|
216 |
492
|
public Element getFormula() {... |
217 |
492
|
if (getNodeVo() == null || getNodeVo().getNodeType() == null) { |
218 |
0
|
return null; |
219 |
|
} |
220 |
492
|
final NodeType nodeType = getNodeVo().getNodeType(); |
221 |
492
|
if (nodeType.getProposition() != null) { |
222 |
55
|
if (nodeType.getProposition().getFormula() != null) { |
223 |
55
|
return nodeType.getProposition().getFormula().getElement(); |
224 |
|
} |
225 |
0
|
return null; |
226 |
437
|
} else if (nodeType.getPredicateDefinition() != null) { |
227 |
0
|
if (nodeType.getPredicateDefinition().getFormula() != null) { |
228 |
0
|
return nodeType.getPredicateDefinition().getFormula().getElement(); |
229 |
|
} |
230 |
0
|
return null; |
231 |
437
|
} else if (nodeType.getFunctionDefinition() != null) { |
232 |
0
|
if (nodeType.getFunctionDefinition().getFormula() != null) { |
233 |
0
|
return nodeType.getFunctionDefinition().getFormula().getElement(); |
234 |
|
} |
235 |
0
|
return null; |
236 |
437
|
} else if (nodeType.getAxiom() != null) { |
237 |
437
|
if (nodeType.getAxiom().getFormula() != null) { |
238 |
437
|
return nodeType.getAxiom().getFormula().getElement(); |
239 |
|
} |
240 |
0
|
return null; |
241 |
|
} |
242 |
0
|
return null; |
243 |
|
} |
244 |
|
} |