|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RenameVo | Line # 29 | 49 | 32 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(27) | |||
Result | |||
0.85714287
|
org.qedeq.kernel.se.test.AbstractValueObjectTestCase.testAll
![]() |
1 PASS | |
0.74725276
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.74725276
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.74725276
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.74725276
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.6813187
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3b
![]() |
1 PASS | |
0.6813187
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration
![]() |
1 PASS | |
0.6813187
|
org.qedeq.kernel.bo.service.unicode.Qedeq2UnicodeTextExecutorTest.testGeneration3b
![]() |
1 PASS | |
0.6813187
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration
![]() |
1 PASS | |
0.2857143
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin
![]() |
1 PASS | |
0.2857143
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin
![]() |
1 PASS | |
0.2857143
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin2
![]() |
1 PASS | |
0.2857143
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck6
![]() |
1 PASS | |
0.2857143
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin3
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive03b
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck4
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind3
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind2
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck1
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin2
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPluginFast
![]() |
1 PASS | |
0.26373628
|
org.qedeq.kernel.xml.dao.GenerateXmlTest.testGeneration
![]() |
1 PASS | |
0.12087912
|
org.qedeq.kernel.se.visitor.QedeqNotNullTraverserTest.testQedeq
![]() |
1 PASS | |
0.07692308
|
org.qedeq.kernel.se.dto.module.RenameVoTest.testGetRename
![]() |
1 PASS | |
0.06593407
|
org.qedeq.kernel.se.dto.module.RenameVoTest.testGetReferences
![]() |
1 PASS | |
0.021978023
|
org.qedeq.kernel.se.dto.module.RenameVoTest.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.Rename; | |
22 | ||
23 | ||
24 | /** | |
25 | * Usage of rule for rename bound subject variable. | |
26 | * | |
27 | * @author Michael Meyling | |
28 | */ | |
29 | public class RenameVo implements Rename { | |
30 | ||
31 | /** Reference to previously proven formula. */ | |
32 | private String reference; | |
33 | ||
34 | /** Bound subject variable that will be replaced. */ | |
35 | private Element originalSubjectVariable; | |
36 | ||
37 | /** Replacement subject variable. */ | |
38 | private Element replacementSubjectVariable; | |
39 | ||
40 | /** This bound occurrence should be replaced. If this value is 0, the replacement position | |
41 | * is not specified. */ | |
42 | private int occurrence; | |
43 | ||
44 | /** | |
45 | * Constructs an addition argument. | |
46 | * | |
47 | * @param reference Reference to a valid formula. | |
48 | * @param originalSubjectVariable Bound subject variable that will be replaced. | |
49 | * @param replacementSubjectVariable Replacement subject variable. | |
50 | * @param occurrence This bound occurrence should be replaced. If this | |
51 | * value is 0, the replacement position | |
52 | * is not specified. */ | |
53 | ||
54 | 334 |
![]() |
55 | final Element replacementSubjectVariable, final int occurrence) { | |
56 | 334 | this.reference = reference; |
57 | 334 | this.originalSubjectVariable = originalSubjectVariable; |
58 | 334 | this.replacementSubjectVariable = replacementSubjectVariable; |
59 | 334 | this.occurrence = occurrence; |
60 | } | |
61 | ||
62 | /** | |
63 | * Default constructor. | |
64 | */ | |
65 | 384 |
![]() |
66 | // nothing to do | |
67 | } | |
68 | ||
69 | 777 |
![]() |
70 | 777 | return this; |
71 | } | |
72 | ||
73 | 719 |
![]() |
74 | 719 | return reference; |
75 | } | |
76 | ||
77 | /** | |
78 | * Set formula reference. | |
79 | * | |
80 | * @param reference Reference to formula. | |
81 | */ | |
82 | 313 |
![]() |
83 | 313 | this.reference = reference; |
84 | } | |
85 | ||
86 | 2 |
![]() |
87 | 2 | if (reference == null) { |
88 | 1 | return ArrayUtils.EMPTY_STRING_ARRAY; |
89 | } | |
90 | 1 | return new String[] {reference }; |
91 | } | |
92 | ||
93 | 442 |
![]() |
94 | 442 | return occurrence; |
95 | } | |
96 | ||
97 | /** | |
98 | * Set occurrence of bound subject variable that should be renamed. | |
99 | * | |
100 | * @param occurrence This occurrence should be renamed. | |
101 | */ | |
102 | 266 |
![]() |
103 | 266 | this.occurrence = occurrence; |
104 | } | |
105 | ||
106 | 2485 |
![]() |
107 | 2485 | return originalSubjectVariable; |
108 | } | |
109 | ||
110 | /** | |
111 | * Set original subject variable, which will be replaced. | |
112 | * | |
113 | * @param originalSubjectVariable Subject variable. | |
114 | */ | |
115 | 315 |
![]() |
116 | 315 | this.originalSubjectVariable = originalSubjectVariable; |
117 | } | |
118 | ||
119 | 1857 |
![]() |
120 | 1857 | return replacementSubjectVariable; |
121 | } | |
122 | ||
123 | /** | |
124 | * Set new subject variable subject variable. | |
125 | * | |
126 | * @param replacementSubjectVariable New subject variable. | |
127 | */ | |
128 | 293 |
![]() |
129 | 293 | this.replacementSubjectVariable = replacementSubjectVariable; |
130 | } | |
131 | ||
132 | 365 |
![]() |
133 | 365 | return "Rename"; |
134 | } | |
135 | ||
136 | 59 |
![]() |
137 | 59 | if (!(obj instanceof RenameVo)) { |
138 | 6 | return false; |
139 | } | |
140 | 53 | final RenameVo other = (RenameVo) obj; |
141 | 53 | return EqualsUtility.equals(reference, other.reference) |
142 | && EqualsUtility.equals(originalSubjectVariable, other.originalSubjectVariable) | |
143 | && EqualsUtility.equals(replacementSubjectVariable, other.replacementSubjectVariable) | |
144 | && (occurrence == other.occurrence); | |
145 | } | |
146 | ||
147 | 64 |
![]() |
148 | 64 | return (reference != null ? reference.hashCode() : 0) |
149 | 64 | ^ (originalSubjectVariable != null ? 2 ^ originalSubjectVariable.hashCode() : 0) |
150 | 64 | ^ (replacementSubjectVariable != null ? 3 ^ replacementSubjectVariable.hashCode() : 0) |
151 | ^ (4 ^ occurrence); | |
152 | } | |
153 | ||
154 | 176 |
![]() |
155 | 176 | StringBuffer result = new StringBuffer(); |
156 | 176 | result.append(getName()); |
157 | 176 | if (reference != null || originalSubjectVariable != null |
158 | || replacementSubjectVariable != null | |
159 | || occurrence != 0) { | |
160 | 159 | result.append(" ("); |
161 | 159 | boolean w = false; |
162 | 159 | if (reference != null) { |
163 | 148 | result.append(reference); |
164 | 148 | w = true; |
165 | } | |
166 | 159 | if (originalSubjectVariable != null) { |
167 | 138 | if (w) { |
168 | 129 | result.append(", "); |
169 | } | |
170 | 138 | result.append(originalSubjectVariable); |
171 | 138 | w = true; |
172 | } | |
173 | 159 | if (replacementSubjectVariable != null) { |
174 | 128 | if (w) { |
175 | 127 | result.append(", "); |
176 | } | |
177 | 128 | result.append("by "); |
178 | 128 | result.append(replacementSubjectVariable); |
179 | 128 | w = true; |
180 | } | |
181 | 159 | if (occurrence != 0) { |
182 | 124 | if (w) { |
183 | 123 | result.append(", "); |
184 | } | |
185 | 124 | result.append("occurrence: "); |
186 | 124 | result.append(occurrence); |
187 | 124 | w = true; |
188 | } | |
189 | 159 | result.append(")"); |
190 | } | |
191 | 176 | return result.toString(); |
192 | } | |
193 | ||
194 | } |
|