Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../../img/srcFileCovDistChart3.png 95% of files have more coverage
28   129   15   2.33
6   69   0.54   12
12     1.25  
1    
 
  SubstPredBo       Line # 28 28 15 26.1% 0.26086956
 
  (6)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, 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.proof.finder;
17   
18    import org.qedeq.base.utility.EqualsUtility;
19    import org.qedeq.kernel.se.base.list.Element;
20    import org.qedeq.kernel.se.base.module.SubstPred;
21   
22   
23    /**
24    * Usage of rule for substitute predicate variable.
25    *
26    * @author Michael Meyling
27    */
 
28    public class SubstPredBo implements SubstPred {
29   
30    /** Reference to previously proven formula. */
31    private int n;
32   
33    /** Function variable that will be substituted. */
34    private Element predicateVariable;
35   
36    /** Replacement formula. */
37    private Element substituteFormula;
38   
39    /**
40    * Constructs an reason.
41    *
42    * @param n Reference to a valid formula.
43    * @param predicateVariable Predicate variable that will be substituted.
44    * @param substituteFormula Replacement formula.
45    */
46   
 
47  75581 toggle public SubstPredBo(final int n, final Element predicateVariable,
48    final Element substituteFormula) {
49  75581 this.n = n;
50  75581 this.predicateVariable = predicateVariable;
51  75581 this.substituteFormula = substituteFormula;
52    }
53   
 
54  0 toggle public SubstPred getSubstPred() {
55  0 return this;
56    }
57   
 
58  61 toggle public String getReference() {
59  61 return "" + n;
60    }
61   
62    /**
63    * Set formula reference.
64    *
65    * @param n Reference to formula.
66    */
 
67  0 toggle public void setN(final int n) {
68  0 this.n = n;
69    }
70   
71    /**
72    * Get formula reference.
73    *
74    * @return Reference to formula.
75    */
 
76  56 toggle public int getN() {
77  56 return n;
78    }
79   
 
80  0 toggle public String[] getReferences() {
81  0 return new String[] {getReference()};
82    }
83   
 
84  89 toggle public Element getPredicateVariable() {
85  89 return predicateVariable;
86    }
87   
 
88  89 toggle public Element getSubstituteFormula() {
89  89 return substituteFormula;
90    }
91   
 
92  0 toggle public String getName() {
93  0 return "SubstPred";
94    }
95   
 
96  0 toggle public boolean equals(final Object obj) {
97  0 if (!(obj instanceof SubstPred)) {
98  0 return false;
99    }
100  0 final SubstPred other = (SubstPred) obj;
101  0 return EqualsUtility.equals(getReference(), other.getReference())
102    && EqualsUtility.equals(predicateVariable, other.getPredicateVariable())
103    && EqualsUtility.equals(substituteFormula, other.getSubstituteFormula());
104    }
105   
 
106  0 toggle public int hashCode() {
107  0 return getReference().hashCode()
108    ^ (2 ^ getPredicateVariable().hashCode())
109    ^ (3 ^ getSubstituteFormula().hashCode());
110    }
111   
 
112  0 toggle public String toString() {
113  0 StringBuffer result = new StringBuffer();
114  0 result.append("SubstPred");
115  0 result.append(" (");
116  0 result.append(getReference());
117  0 if (getPredicateVariable() != null) {
118  0 result.append(", ");
119  0 result.append(getPredicateVariable());
120    }
121  0 if (getSubstituteFormula() != null) {
122  0 result.append("by ");
123  0 result.append(getSubstituteFormula());
124    }
125  0 result.append(")");
126  0 return result.toString();
127    }
128   
129    }