Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 154   Methods: 16
NCLOC: 81   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PropositionBo.java 100% 81,5% 68,8% 81,1%
coverage coverage
 1    /* $Id: PropositionBo.java,v 1.5 2006/10/20 20:23:00 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.FunctionDefinition;
 22    import org.qedeq.kernel.base.module.PredicateDefinition;
 23    import org.qedeq.kernel.base.module.FormulaOrTerm;
 24    import org.qedeq.kernel.base.module.LatexList;
 25    import org.qedeq.kernel.base.module.Proof;
 26    import org.qedeq.kernel.base.module.ProofList;
 27    import org.qedeq.kernel.base.module.Proposition;
 28    import org.qedeq.kernel.base.module.Rule;
 29    import org.qedeq.kernel.utility.EqualsUtility;
 30   
 31   
 32    /**
 33    * Proposition.
 34    *
 35    * @version $Revision: 1.5 $
 36    * @author Michael Meyling
 37    */
 38    public final class PropositionBo implements Proposition {
 39   
 40    /** Proposition formula. */
 41    private FormulaOrTerm formula;
 42   
 43    /** List of proofs. */
 44    private ProofListBo proofList;
 45   
 46    /** Further proposition description. Normally <code>null</code>. */
 47    private LatexList description;
 48   
 49    /**
 50    * Constructs a new proposition.
 51    */
 52  208 public PropositionBo() {
 53    // nothing to do
 54    }
 55   
 56  0 public Axiom getAxiom() {
 57  0 return null;
 58    }
 59   
 60  0 public PredicateDefinition getPredicateDefinition() {
 61  0 return null;
 62    }
 63   
 64  0 public FunctionDefinition getFunctionDefinition() {
 65  0 return null;
 66    }
 67   
 68  0 public Proposition getProposition() {
 69  0 return this;
 70    }
 71   
 72  0 public Rule getRule() {
 73  0 return null;
 74    }
 75   
 76    /**
 77    * Set proposition formula.
 78    *
 79    * @param formula Proposition formula.
 80    */
 81  178 public final void setFormula(final FormulaOrTerm formula) {
 82  178 this.formula = formula;
 83    }
 84   
 85  351 public final FormulaOrTerm getFormula() {
 86  351 return formula;
 87    }
 88   
 89    /**
 90    * Set proof list of this proposition.
 91    *
 92    * @param proofList Proof list.
 93    */
 94  31 public final void setProofList(final ProofListBo proofList) {
 95  31 this.proofList = proofList;
 96    }
 97   
 98  348 public final ProofList getProofList() {
 99  348 return proofList;
 100    }
 101   
 102    /**
 103    * Add proof for this proposition.
 104    *
 105    * @param proof Proof to add.
 106    */
 107  7 public final void addProof(final Proof proof) {
 108  7 if (proofList == null) {
 109  2 proofList = new ProofListBo();
 110    }
 111  7 proofList.add(proof);
 112    }
 113   
 114    /**
 115    * Set description. Only necessary if formula is not self-explanatory.
 116    *
 117    * @param description Description.
 118    */
 119  19 public final void setDescription(final LatexList description) {
 120  19 this.description = description;
 121    }
 122   
 123  333 public LatexList getDescription() {
 124  333 return description;
 125    }
 126   
 127  59 public boolean equals(final Object obj) {
 128  59 if (!(obj instanceof PropositionBo)) {
 129  6 return false;
 130    }
 131  53 final PropositionBo other = (PropositionBo) obj;
 132  53 return EqualsUtility.equals(getFormula(), other.getFormula())
 133    && EqualsUtility.equals(getDescription(), other.getDescription())
 134    && EqualsUtility.equals(getProofList(), other.getProofList());
 135    }
 136   
 137  60 public int hashCode() {
 138  60 return (getFormula() != null ? getFormula().hashCode() : 0)
 139  60 ^ (getDescription() != null ? 1 ^ getDescription().hashCode() : 0)
 140  60 ^ (getProofList() != null ? 2 ^ getProofList().hashCode() : 0);
 141    }
 142   
 143  44 public String toString() {
 144  44 final StringBuffer buffer = new StringBuffer();
 145  44 buffer.append("Proposition:\n");
 146  44 buffer.append(getFormula());
 147  44 buffer.append("Description:\n");
 148  44 buffer.append(getDescription());
 149  44 buffer.append("Proof:\n");
 150  44 buffer.append(getProofList());
 151  44 return buffer.toString();
 152    }
 153   
 154    }