|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SubstPredVo | Line # 29 | 40 | 27 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
(32) | |||
Result | |||
0.84210527
|
org.qedeq.kernel.se.test.AbstractValueObjectTestCase.testAll
![]() |
1 PASS | |
0.6315789
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.6315789
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testNegativeGeneration2
![]() |
1 PASS | |
0.6315789
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.6315789
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration2
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3c
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration3b
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind
![]() |
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.logic.proof.finder.ProofFinderImplTest.testFind2
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.unicode.Qedeq2UnicodeTextExecutorTest.testGeneration1b
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.unicode.GenerateUtf8Test.testGeneration1b
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.unicode.Qedeq2UnicodeTextExecutorTest.testGeneration3c
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPlugin2
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.logic.SimpleProofFinderPluginTest.testPluginFast
![]() |
1 PASS | |
0.55263156
|
org.qedeq.kernel.bo.service.latex.GenerateLatexTest.testGeneration
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck4
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin4
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.logic.proof.checker.ProofCheckerTest.testCheck1
![]() |
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.logic.proof.checker.ProofCheckerTest.testCheck6
![]() |
1 PASS | |
0.18421052
|
org.qedeq.kernel.bo.service.logic.FormalProofCheckerPluginTest.testPlugin3
![]() |
1 PASS | |
0.17105263
|
org.qedeq.kernel.se.dto.module.SubstPredVoTest.testGetSubstPred
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.wf.FormulaCheckerContextTest.testPositive03b
![]() |
1 PASS | |
0.15789473
|
org.qedeq.kernel.bo.logic.proof.finder.ProofFinderImplTest.testFind3
![]() |
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.078947365
|
org.qedeq.kernel.se.dto.module.SubstPredVoTest.testGetReferences
![]() |
1 PASS | |
0.02631579
|
org.qedeq.kernel.se.dto.module.SubstPredVoTest.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.SubstPred; | |
22 | ||
23 | ||
24 | /** | |
25 | * Usage of rule for substitute predicate variable. | |
26 | * | |
27 | * @author Michael Meyling | |
28 | */ | |
29 | public class SubstPredVo implements SubstPred { | |
30 | ||
31 | /** Reference to previously proven formula. */ | |
32 | private String reference; | |
33 | ||
34 | /** Function variable that will be substituted. */ | |
35 | private Element predicateVariable; | |
36 | ||
37 | /** Replacement formula. */ | |
38 | private Element substituteFormula; | |
39 | ||
40 | /** | |
41 | * Constructs an reason. | |
42 | * | |
43 | * @param reference Reference to a valid formula. | |
44 | * @param predicateVariable Predicate variable that will be substituted. | |
45 | * @param substituteFormula Replacement formula. | |
46 | */ | |
47 | ||
48 | 4848 |
![]() |
49 | final Element substituteFormula) { | |
50 | 4848 | this.reference = reference; |
51 | 4848 | this.predicateVariable = predicateVariable; |
52 | 4848 | this.substituteFormula = substituteFormula; |
53 | } | |
54 | ||
55 | /** | |
56 | * Default constructor. | |
57 | */ | |
58 | 49 |
![]() |
59 | // nothing to do | |
60 | } | |
61 | ||
62 | 14248 |
![]() |
63 | 14248 | return this; |
64 | } | |
65 | ||
66 | 12676 |
![]() |
67 | 12676 | 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 | 22052 |
![]() |
87 | 22052 | return predicateVariable; |
88 | } | |
89 | ||
90 | /** | |
91 | * Set predicate variable that will be substituted. | |
92 | * | |
93 | * @param predicateVariable Function variable that will be replaced. | |
94 | */ | |
95 | 18 |
![]() |
96 | 18 | this.predicateVariable = predicateVariable; |
97 | } | |
98 | ||
99 | 29722 |
![]() |
100 | 29722 | return substituteFormula; |
101 | } | |
102 | ||
103 | /** | |
104 | * Set substitution formula. | |
105 | * | |
106 | * @param substituteFormula New formula. | |
107 | */ | |
108 | 18 |
![]() |
109 | 18 | this.substituteFormula = substituteFormula; |
110 | } | |
111 | ||
112 | 3933 |
![]() |
113 | 3933 | return "SubstPred"; |
114 | } | |
115 | ||
116 | 49 |
![]() |
117 | 49 | if (!(obj instanceof SubstPred)) { |
118 | 5 | return false; |
119 | } | |
120 | 44 | final SubstPred other = (SubstPred) obj; |
121 | 44 | return EqualsUtility.equals(getReference(), other.getReference()) |
122 | && EqualsUtility.equals(predicateVariable, other.getPredicateVariable()) | |
123 | && EqualsUtility.equals(substituteFormula, other.getSubstituteFormula()); | |
124 | } | |
125 | ||
126 | 52 |
![]() |
127 | 52 | return (getReference() != null ? getReference().hashCode() : 0) |
128 | 52 | ^ (getPredicateVariable() != null ? 2 ^ getPredicateVariable().hashCode() : 0) |
129 | 52 | ^ (getSubstituteFormula() != null ? 3 ^ getSubstituteFormula().hashCode() : 0); |
130 | } | |
131 | ||
132 | 1850 |
![]() |
133 | 1850 | StringBuffer result = new StringBuffer(); |
134 | 1850 | result.append(getName()); |
135 | 1850 | if (getReference() != null || getPredicateVariable() != null |
136 | || getSubstituteFormula() != null) { | |
137 | 1826 | result.append(" ("); |
138 | 1826 | boolean w = false; |
139 | 1826 | if (getReference() != null) { |
140 | 1804 | result.append(getReference()); |
141 | 1804 | w = true; |
142 | } | |
143 | 1826 | if (getPredicateVariable() != null) { |
144 | 1794 | if (w) { |
145 | 1777 | result.append(", "); |
146 | } | |
147 | 1794 | result.append(getPredicateVariable()); |
148 | 1794 | w = true; |
149 | } | |
150 | 1826 | if (getSubstituteFormula() != null) { |
151 | 1792 | if (w) { |
152 | 1787 | result.append(", "); |
153 | } | |
154 | 1792 | result.append("by "); |
155 | 1792 | result.append(getSubstituteFormula()); |
156 | 1792 | w = true; |
157 | } | |
158 | 1826 | result.append(")"); |
159 | } | |
160 | 1850 | return result.toString(); |
161 | } | |
162 | ||
163 | } |
|