Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
36   193   28   1.71
14   106   0.78   21
21     1.33  
1    
 
  PropositionVo       Line # 37 36 28 100% 1.0
 
  (69)
 
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.Axiom;
20    import org.qedeq.kernel.se.base.module.FormalProofList;
21    import org.qedeq.kernel.se.base.module.Formula;
22    import org.qedeq.kernel.se.base.module.FunctionDefinition;
23    import org.qedeq.kernel.se.base.module.InitialFunctionDefinition;
24    import org.qedeq.kernel.se.base.module.InitialPredicateDefinition;
25    import org.qedeq.kernel.se.base.module.LatexList;
26    import org.qedeq.kernel.se.base.module.PredicateDefinition;
27    import org.qedeq.kernel.se.base.module.ProofList;
28    import org.qedeq.kernel.se.base.module.Proposition;
29    import org.qedeq.kernel.se.base.module.Rule;
30   
31   
32    /**
33    * Proposition.
34    *
35    * @author Michael Meyling
36    */
 
37    public class PropositionVo implements Proposition {
38   
39    /** Proposition formula. */
40    private Formula formula;
41   
42    /** Further proposition description. Normally <code>null</code>. */
43    private LatexList description;
44   
45    /** List of non formal proofs. */
46    private ProofListVo proofList;
47   
48    /** List of formal proofs. */
49    private FormalProofListVo formalProofList;
50   
51    /**
52    * Constructs a new proposition.
53    */
 
54  19385 toggle public PropositionVo() {
55    // nothing to do
56    }
57   
 
58  1 toggle public Axiom getAxiom() {
59  1 return null;
60    }
61   
 
62  1 toggle public InitialPredicateDefinition getInitialPredicateDefinition() {
63  1 return null;
64    }
65   
 
66  1 toggle public PredicateDefinition getPredicateDefinition() {
67  1 return null;
68    }
69   
 
70  1 toggle public InitialFunctionDefinition getInitialFunctionDefinition() {
71  1 return null;
72    }
73   
 
74  1 toggle public FunctionDefinition getFunctionDefinition() {
75  1 return null;
76    }
77   
 
78  112278 toggle public Proposition getProposition() {
79  112278 return this;
80    }
81   
 
82  1 toggle public Rule getRule() {
83  1 return null;
84    }
85   
86    /**
87    * Set proposition formula.
88    *
89    * @param formula Proposition formula.
90    */
 
91  19287 toggle public final void setFormula(final FormulaVo formula) {
92  19287 this.formula = formula;
93    }
94   
 
95  206876 toggle public final Formula getFormula() {
96  206876 return formula;
97    }
98   
99    /**
100    * Set description. Only necessary if formula is not self-explanatory.
101    *
102    * @param description Description.
103    */
 
104  339 toggle public final void setDescription(final LatexListVo description) {
105  339 this.description = description;
106    }
107   
 
108  55933 toggle public LatexList getDescription() {
109  55933 return description;
110    }
111   
112    /**
113    * Set proof list.
114    *
115    * @param proofList Proof list.
116    */
 
117  2776 toggle public final void setProofList(final ProofListVo proofList) {
118  2776 this.proofList = proofList;
119    }
120   
 
121  63701 toggle public final ProofList getProofList() {
122  63701 return proofList;
123    }
124   
125    /**
126    * Add proof to this list.
127    *
128    * @param proof Proof to add.
129    */
 
130  2951 toggle public final void addProof(final ProofVo proof) {
131  2951 if (proofList == null) {
132  2786 proofList = new ProofListVo();
133    }
134  2951 proofList.add(proof);
135    }
136   
137    /**
138    * Set proof list.
139    *
140    * @param formalProofList Proof list.
141    */
 
142  611 toggle public final void setFormalProofList(final FormalProofListVo formalProofList) {
143  611 this.formalProofList = formalProofList;
144    }
145   
 
146  149469 toggle public final FormalProofList getFormalProofList() {
147  149469 return formalProofList;
148    }
149   
150    /**
151    * Add non formal proof to this list.
152    *
153    * @param proof Proof to add.
154    */
 
155  554 toggle public final void addFormalProof(final FormalProofVo proof) {
156  554 if (formalProofList == null) {
157  549 formalProofList = new FormalProofListVo();
158    }
159  554 formalProofList.add(proof);
160    }
161   
 
162  86 toggle public boolean equals(final Object obj) {
163  86 if (!(obj instanceof PropositionVo)) {
164  8 return false;
165    }
166  78 final PropositionVo other = (PropositionVo) obj;
167  78 return EqualsUtility.equals(getFormula(), other.getFormula())
168    && EqualsUtility.equals(getDescription(), other.getDescription())
169    && EqualsUtility.equals(getProofList(), other.getProofList())
170    && EqualsUtility.equals(getFormalProofList(), other.getFormalProofList());
171    }
172   
 
173  80 toggle public int hashCode() {
174  80 return (getFormula() != null ? getFormula().hashCode() : 0)
175  80 ^ (getDescription() != null ? 1 ^ getDescription().hashCode() : 0)
176  80 ^ (getProofList() != null ? 2 ^ getProofList().hashCode() : 0)
177  80 ^ (getFormalProofList() != null ? 3 ^ getFormalProofList().hashCode() : 0);
178    }
179   
 
180  58 toggle public String toString() {
181  58 final StringBuffer buffer = new StringBuffer();
182  58 buffer.append("Proposition:\n");
183  58 buffer.append(getFormula());
184  58 buffer.append("\nDescription:\n");
185  58 buffer.append(getDescription());
186  58 buffer.append("\nProofs:\n");
187  58 buffer.append(getProofList());
188  58 buffer.append("\nFormal Proofs:\n");
189  58 buffer.append(getFormalProofList());
190  58 return buffer.toString();
191    }
192   
193    }