Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../../img/srcFileCovDistChart6.png 80% of files have more coverage
28   141   18   2
8   68   0.64   14
14     1.29  
1    
 
  ModusPonensBo       Line # 27 28 18 52% 0.52
 
No Tests
 
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.module.ModusPonens;
20   
21   
22    /**
23    * Modes Ponens usage.
24    *
25    * @author Michael Meyling
26    */
 
27    public class ModusPonensBo implements ModusPonens {
28   
29    /** Reference to a formula like A -> B. */
30    private int n1;
31   
32    /** Usually reference to a formula like A. */
33    private int n2;
34   
35    /**
36    * Constructs a Modus Ponens argument.
37    *
38    * @param n1 Usually reference to a formula like A -> B.
39    * @param n2 Usually reference to a formula like A.
40    */
 
41  809 toggle public ModusPonensBo(final int n1, final int n2) {
42  809 this.n1 = n1;
43  809 this.n2 = n2;
44    }
45   
 
46  0 toggle public ModusPonens getModusPonens() {
47  0 return this;
48    }
49   
 
50  48 toggle public String getReference1() {
51  48 return "" + n1;
52    }
53   
54    /**
55    * Set first formula reference.
56    *
57    * @param n1 Reference to formula.
58    */
 
59  0 toggle public void setN1(final int n1) {
60  0 this.n1 = n1;
61    }
62   
63    /**
64    * Get first formula reference.
65    *
66    * @return Reference to formula.
67    */
 
68  32 toggle public int getN1() {
69  32 return n1;
70    }
71   
 
72  32 toggle public String getReference2() {
73  32 return "" + n2;
74    }
75   
76    /**
77    * Set second formula reference.
78    *
79    * @param n2 Reference to formula.
80    */
 
81  0 toggle public void setN2(final int n2) {
82  0 this.n2 = n2;
83    }
84   
85    /**
86    * Get second formula reference.
87    *
88    * @return Reference to formula.
89    */
 
90  32 toggle public int getN2() {
91  32 return n2;
92    }
93   
 
94  0 toggle public String[] getReferences() {
95  0 return new String[] {getReference1(), getReference2()};
96    }
97   
98    /**
99    * Get references to previous lines.
100    *
101    * @return List of references.
102    */
 
103  0 toggle public int[] getLines() {
104  0 return new int[] {getN1(), getN2()};
105    }
106   
 
107  0 toggle public boolean equals(final Object obj) {
108  0 if (!(obj instanceof ModusPonens)) {
109  0 return false;
110    }
111  0 final ModusPonens other = (ModusPonens) obj;
112  0 return EqualsUtility.equals(getReference1(), other.getReference1())
113    && EqualsUtility.equals(getReference2(), other.getReference2());
114    }
115   
 
116  0 toggle public int hashCode() {
117  0 return getReference1().hashCode() ^ getReference2().hashCode();
118    }
119   
 
120  16 toggle public String toString() {
121  16 StringBuffer result = new StringBuffer();
122  16 result.append("MP");
123  16 result.append(" (");
124  16 if (getReference1() != null) {
125  16 result.append(getReference1());
126    }
127  16 if (getReference2() != null) {
128  16 if (getReference1() != null) {
129  16 result.append(", ");
130    }
131  16 result.append(getReference2());
132    }
133  16 result.append(")");
134  16 return result.toString();
135    }
136   
 
137  0 toggle public String getName() {
138  0 return "MP";
139    }
140   
141    }