Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 149   Methods: 15
NCLOC: 77   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PropositionBo.java 100% 84,6% 73,3% 84,3%
coverage coverage
 1    /* $Id: PropositionBo.java,v 1.4 2005/12/09 18:23:32 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2005, Michael Meyling <mime@qedeq.org>.
 6    *
 7    * "Hilbert II" is free software; you can redistribute
 8    * it and/or modify it under the terms of the GNU General Public
 9    * License as published by the Free Software Foundation; either
 10    * version 2 of the License, or (at your option) any later version.
 11    *
 12    * This program is distributed in the hope that it will be useful,
 13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 15    * GNU General Public License for more details.
 16    */
 17   
 18    package org.qedeq.kernel.bo.module;
 19   
 20    import org.qedeq.kernel.base.module.Axiom;
 21    import org.qedeq.kernel.base.module.Definition;
 22    import org.qedeq.kernel.base.module.FormulaOrTerm;
 23    import org.qedeq.kernel.base.module.LatexList;
 24    import org.qedeq.kernel.base.module.Proof;
 25    import org.qedeq.kernel.base.module.ProofList;
 26    import org.qedeq.kernel.base.module.Proposition;
 27    import org.qedeq.kernel.base.module.Rule;
 28    import org.qedeq.kernel.utility.EqualsUtility;
 29   
 30   
 31    /**
 32    * Proposition.
 33    *
 34    * @version $Revision: 1.4 $
 35    * @author Michael Meyling
 36    */
 37    public final class PropositionBo implements Proposition {
 38   
 39    /** Proposition formula. */
 40    private FormulaOrTerm formula;
 41   
 42    /** List of proofs. */
 43    private ProofListBo proofList;
 44   
 45    /** Further proposition description. Normally <code>null</code>. */
 46    private LatexList description;
 47   
 48    /**
 49    * Constructs a new proposition.
 50    */
 51  55 public PropositionBo() {
 52    // nothing to do
 53    }
 54   
 55  0 public Axiom getAxiom() {
 56  0 return null;
 57    }
 58   
 59  0 public Definition getDefinition() {
 60  0 return null;
 61    }
 62   
 63  0 public Proposition getProposition() {
 64  0 return this;
 65    }
 66   
 67  0 public Rule getRule() {
 68  0 return null;
 69    }
 70   
 71    /**
 72    * Set proposition formula.
 73    *
 74    * @param formula Proposition formula.
 75    */
 76  27 public final void setFormula(final FormulaOrTerm formula) {
 77  27 this.formula = formula;
 78    }
 79   
 80  249 public final FormulaOrTerm getFormula() {
 81  249 return formula;
 82    }
 83   
 84    /**
 85    * Set proof list of this proposition.
 86    *
 87    * @param proofList Proof list.
 88    */
 89  27 public final void setProofList(final ProofListBo proofList) {
 90  27 this.proofList = proofList;
 91    }
 92   
 93  246 public final ProofList getProofList() {
 94  246 return proofList;
 95    }
 96   
 97    /**
 98    * Add proof for this proposition.
 99    *
 100    * @param proof Proof to add.
 101    */
 102  7 public final void addProof(final Proof proof) {
 103  7 if (proofList == null) {
 104  2 proofList = new ProofListBo();
 105    }
 106  7 proofList.add(proof);
 107    }
 108   
 109    /**
 110    * Set description. Only necessary if formula is not self-explanatory.
 111    *
 112    * @param description Description.
 113    */
 114  18 public final void setDescription(final LatexList description) {
 115  18 this.description = description;
 116    }
 117   
 118  231 public LatexList getDescription() {
 119  231 return description;
 120    }
 121   
 122  59 public boolean equals(final Object obj) {
 123  59 if (!(obj instanceof PropositionBo)) {
 124  6 return false;
 125    }
 126  53 final PropositionBo other = (PropositionBo) obj;
 127  53 return EqualsUtility.equals(getFormula(), other.getFormula())
 128    && EqualsUtility.equals(getDescription(), other.getDescription())
 129    && EqualsUtility.equals(getProofList(), other.getProofList());
 130    }
 131   
 132  58 public int hashCode() {
 133  58 return (getFormula() != null ? getFormula().hashCode() : 0)
 134  58 ^ (getDescription() != null ? 1 ^ getDescription().hashCode() : 0)
 135  58 ^ (getProofList() != null ? 2 ^ getProofList().hashCode() : 0);
 136    }
 137   
 138  42 public String toString() {
 139  42 final StringBuffer buffer = new StringBuffer();
 140  42 buffer.append("Proposition:\n");
 141  42 buffer.append(getFormula());
 142  42 buffer.append("Description:\n");
 143  42 buffer.append(getDescription());
 144  42 buffer.append("Proof:\n");
 145  42 buffer.append(getProofList());
 146  42 return buffer.toString();
 147    }
 148   
 149    }