Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
18   132   17   1.5
10   58   0.94   12
12     1.42  
1    
 
  FormalProofLineVo       Line # 29 18 17 100% 1.0
 
  (33)
 
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.se.dto.module;
17   
18    import org.qedeq.base.utility.EqualsUtility;
19    import org.qedeq.kernel.se.base.module.FormalProofLine;
20    import org.qedeq.kernel.se.base.module.Formula;
21    import org.qedeq.kernel.se.base.module.Reason;
22   
23   
24    /**
25    * Contains a formal proof for a proposition.
26    *
27    * @author Michael Meyling
28    */
 
29    public class FormalProofLineVo implements FormalProofLine {
30   
31    /** Label for back references. Might be <code>null</code>. */
32    private String label;
33   
34    /** Rule that is used for deriving. */
35    private Reason reason;
36   
37    /** Derived formula. */
38    private Formula formula;
39   
40    /**
41    * Constructs an proof line.
42    *
43    * @param formula New derived formula.
44    * @param reason Rule that was used to derive the formula.
45    */
 
46  22 toggle public FormalProofLineVo(final Formula formula, final Reason reason) {
47  22 this.label = null;
48  22 this.reason = reason;
49  22 this.formula = formula;
50    }
51   
52    /**
53    * Constructs an proof line.
54    *
55    * @param label Label for back references. Might be <code>null</code>.
56    * @param formula New derived formula.
57    * @param reason Rule that was used to derive the formula.
58    */
 
59  5591 toggle public FormalProofLineVo(final String label, final Formula formula, final Reason reason) {
60  5591 this.label = label;
61  5591 this.reason = reason;
62  5591 this.formula = formula;
63    }
64   
65    /**
66    * Default constructor.
67    */
 
68  5657 toggle public FormalProofLineVo() {
69    // nothing to do
70    }
71   
 
72  490436 toggle public Formula getFormula() {
73  490436 return formula;
74    }
75   
76    /**
77    * Set proof line formula.
78    *
79    * @param formula Set formula.
80    */
 
81  5609 toggle public void setFormula(final Formula formula) {
82  5609 this.formula = formula;
83    }
84   
 
85  56859 toggle public String getLabel() {
86  56859 return label;
87    }
88   
89    /**
90    * Set label for proof line.
91    *
92    * @param label Set this label.
93    */
 
94  5595 toggle public void setLabel(final String label) {
95  5595 this.label = label;
96    }
97   
 
98  447734 toggle public Reason getReason() {
99  447734 return reason;
100    }
101   
102    /**
103    * Set reason type for proof line.
104    *
105    * @param reason Set this reason type.
106    */
 
107  5634 toggle public void setReason(final Reason reason) {
108  5634 this.reason = reason;
109    }
110   
 
111  144 toggle public boolean equals(final Object obj) {
112  144 if (!(obj instanceof FormalProofLineVo)) {
113  6 return false;
114    }
115  138 final FormalProofLineVo other = (FormalProofLineVo) obj;
116  138 return EqualsUtility.equals(label, other.label)
117    && EqualsUtility.equals(formula, other.formula)
118    && EqualsUtility.equals(reason, other.reason);
119    }
120   
 
121  217 toggle public int hashCode() {
122  217 return (label != null ? label.hashCode() : 0)
123  217 ^ (formula != null ? 1 ^ formula.hashCode() : 0)
124  217 ^ (reason != null ? 2 ^ reason.hashCode() : 0);
125    }
126   
 
127  173 toggle public String toString() {
128  173 return (label != null ? "[" + label + "] " : " ") + getFormula() + " "
129    + getReason();
130    }
131   
132    }