|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SubstFuncVo | Line # 29 | 40 | 27 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(27) | |||
Result | |||
0.84210527
|
org.qedeq.kernel.se.test.AbstractValueObjectTestCase.testAll
![]() |
1 PASS | |
0.57894737
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.57894737
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3b
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.unicode.Qedeq2UnicodeTextExecutorTest.testGeneration3b
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration
![]() |
1 PASS | |
0.5
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.5
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin2
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin3
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive03b
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck4
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind3
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind2
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck1
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin2
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPluginFast
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck6
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.xml.dao.GenerateXmlTest.testGeneration
![]() |
1 PASS | |
0.14473684
|
org.qedeq.kernel.se.visitor.QedeqNotNullTraverserTest.testQedeq
![]() |
1 PASS | |
0.09210526
|
org.qedeq.kernel.se.dto.module.SubstFuncVoTest.testGetSubstFunc
![]() |
1 PASS | |
0.078947365
|
org.qedeq.kernel.se.dto.module.SubstFuncVoTest.testGetReferences
![]() |
1 PASS | |
0.02631579
|
org.qedeq.kernel.se.dto.module.SubstFuncVoTest.testGetName
![]() |
1 PASS | |
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.se.dto.module; | |
17 | ||
18 | import org.apache.commons.lang.ArrayUtils; | |
19 | import org.qedeq.base.utility.EqualsUtility; | |
20 | import org.qedeq.kernel.se.base.list.Element; | |
21 | import org.qedeq.kernel.se.base.module.SubstFunc; | |
22 | ||
23 | ||
24 | /** | |
25 | * Usage of rule for substitute function variable. | |
26 | * | |
27 | * @author Michael Meyling | |
28 | */ | |
29 | public class SubstFuncVo implements SubstFunc { | |
30 | ||
31 | /** Reference to previously proven formula. */ | |
32 | private String reference; | |
33 | ||
34 | /** Function variable that will be substituted. */ | |
35 | private Element functionVariable; | |
36 | ||
37 | /** Replacement term. */ | |
38 | private Element substituteTerm; | |
39 | ||
40 | /** | |
41 | * Constructs an reason. | |
42 | * | |
43 | * @param reference Reference to a valid formula. | |
44 | * @param functionVariable Function variable that will be substituted. | |
45 | * @param substituteFormula Replacement term. | |
46 | */ | |
47 | ||
48 | 118 |
![]() |
49 | final Element substituteFormula) { | |
50 | 118 | this.reference = reference; |
51 | 118 | this.functionVariable = functionVariable; |
52 | 118 | this.substituteTerm = substituteFormula; |
53 | } | |
54 | ||
55 | /** | |
56 | * Default constructor. | |
57 | */ | |
58 | 49 |
![]() |
59 | // nothing to do | |
60 | } | |
61 | ||
62 | 308 |
![]() |
63 | 308 | return this; |
64 | } | |
65 | ||
66 | 121 |
![]() |
67 | 121 | return reference; |
68 | } | |
69 | ||
70 | /** | |
71 | * Set formula reference. | |
72 | * | |
73 | * @param reference Reference to formula. | |
74 | */ | |
75 | 16 |
![]() |
76 | 16 | this.reference = reference; |
77 | } | |
78 | ||
79 | 2 |
![]() |
80 | 2 | if (reference == null) { |
81 | 1 | return ArrayUtils.EMPTY_STRING_ARRAY; |
82 | } | |
83 | 1 | return new String[] {reference }; |
84 | } | |
85 | ||
86 | 295 |
![]() |
87 | 295 | return functionVariable; |
88 | } | |
89 | ||
90 | /** | |
91 | * Set function variable that will be substituted. | |
92 | * | |
93 | * @param functionVariable Function variable that will be replaced. | |
94 | */ | |
95 | 18 |
![]() |
96 | 18 | this.functionVariable = functionVariable; |
97 | } | |
98 | ||
99 | 494 |
![]() |
100 | 494 | return substituteTerm; |
101 | } | |
102 | ||
103 | /** | |
104 | * Set substitution term. | |
105 | * | |
106 | * @param substituteTerm New term. | |
107 | */ | |
108 | 18 |
![]() |
109 | 18 | this.substituteTerm = substituteTerm; |
110 | } | |
111 | ||
112 | 90 |
![]() |
113 | 90 | return "SubstFun"; |
114 | } | |
115 | ||
116 | 47 |
![]() |
117 | 47 | if (!(obj instanceof SubstFuncVo)) { |
118 | 5 | return false; |
119 | } | |
120 | 42 | final SubstFuncVo other = (SubstFuncVo) obj; |
121 | 42 | return EqualsUtility.equals(reference, other.reference) |
122 | && EqualsUtility.equals(functionVariable, other.functionVariable) | |
123 | && EqualsUtility.equals(substituteTerm, other.substituteTerm); | |
124 | } | |
125 | ||
126 | 52 |
![]() |
127 | 52 | return (reference != null ? reference.hashCode() : 0) |
128 | 52 | ^ (functionVariable != null ? 2 ^ functionVariable.hashCode() : 0) |
129 | 52 | ^ (substituteTerm != null ? 3 ^ substituteTerm.hashCode() : 0); |
130 | } | |
131 | ||
132 | 58 |
![]() |
133 | 58 | StringBuffer result = new StringBuffer(); |
134 | 58 | result.append(getName()); |
135 | 58 | if (reference != null || functionVariable != null |
136 | || substituteTerm != null) { | |
137 | 42 | result.append(" ("); |
138 | 42 | boolean w = false; |
139 | 42 | if (reference != null) { |
140 | 40 | result.append(reference); |
141 | 40 | w = true; |
142 | } | |
143 | 42 | if (functionVariable != null) { |
144 | 28 | if (w) { |
145 | 27 | result.append(", "); |
146 | } | |
147 | 28 | result.append(functionVariable); |
148 | 28 | w = true; |
149 | } | |
150 | 42 | if (substituteTerm != null) { |
151 | 36 | if (w) { |
152 | 35 | result.append(", "); |
153 | } | |
154 | 36 | result.append("by "); |
155 | 36 | result.append(substituteTerm); |
156 | 36 | w = true; |
157 | } | |
158 | 42 | result.append(")"); |
159 | } | |
160 | 58 | return result.toString(); |
161 | } | |
162 | ||
163 | } |
|