Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 153   Methods: 16
NCLOC: 80   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PropositionVo.java 100% 85,2% 75% 84,9%
coverage coverage
 1    /* $Id: PropositionVo.java,v 1.7 2006/10/20 20:23:01 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.dto.module;
 19   
 20    import org.qedeq.kernel.base.module.Axiom;
 21    import org.qedeq.kernel.base.module.Formula;
 22    import org.qedeq.kernel.base.module.FunctionDefinition;
 23    import org.qedeq.kernel.base.module.LatexList;
 24    import org.qedeq.kernel.base.module.PredicateDefinition;
 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.7 $
 35    * @author Michael Meyling
 36    */
 37    public final 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 proofs. */
 46    private ProofListVo proofList;
 47   
 48    /**
 49    * Constructs a new proposition.
 50    */
 51  382 public PropositionVo() {
 52    // nothing to do
 53    }
 54   
 55  0 public Axiom getAxiom() {
 56  0 return null;
 57    }
 58   
 59  0 public PredicateDefinition getPredicateDefinition() {
 60  0 return null;
 61    }
 62   
 63  0 public FunctionDefinition getFunctionDefinition() {
 64  0 return null;
 65    }
 66   
 67  314 public Proposition getProposition() {
 68  314 return this;
 69    }
 70   
 71  0 public Rule getRule() {
 72  0 return null;
 73    }
 74   
 75    /**
 76    * Set proposition formula.
 77    *
 78    * @param formula Proposition formula.
 79    */
 80  352 public final void setFormula(final FormulaVo formula) {
 81  352 this.formula = formula;
 82    }
 83   
 84  1269 public final Formula getFormula() {
 85  1269 return formula;
 86    }
 87   
 88    /**
 89    * Set description. Only necessary if formula is not self-explanatory.
 90    *
 91    * @param description Description.
 92    */
 93  22 public final void setDescription(final LatexListVo description) {
 94  22 this.description = description;
 95    }
 96   
 97  612 public LatexList getDescription() {
 98  612 return description;
 99    }
 100   
 101    /**
 102    * Set proof list.
 103    *
 104    * @param proofList Proof list.
 105    */
 106  31 public final void setProofList(final ProofListVo proofList) {
 107  31 this.proofList = proofList;
 108    }
 109   
 110  683 public final ProofList getProofList() {
 111  683 return proofList;
 112    }
 113   
 114    /**
 115    * Add proof to this list.
 116    *
 117    * @param proof Proof to add.
 118    */
 119  33 public final void addProof(final ProofVo proof) {
 120  33 if (proofList == null) {
 121  28 proofList = new ProofListVo();
 122    }
 123  33 proofList.add(proof);
 124    }
 125   
 126  59 public boolean equals(final Object obj) {
 127  59 if (!(obj instanceof PropositionVo)) {
 128  6 return false;
 129    }
 130  53 final PropositionVo other = (PropositionVo) obj;
 131  53 return EqualsUtility.equals(getFormula(), other.getFormula())
 132    && EqualsUtility.equals(getDescription(), other.getDescription())
 133    && EqualsUtility.equals(getProofList(), other.getProofList());
 134    }
 135   
 136  60 public int hashCode() {
 137  60 return (getFormula() != null ? getFormula().hashCode() : 0)
 138  60 ^ (getDescription() != null ? 1 ^ getDescription().hashCode() : 0)
 139  60 ^ (getProofList() != null ? 2 ^ getProofList().hashCode() : 0);
 140    }
 141   
 142  44 public String toString() {
 143  44 final StringBuffer buffer = new StringBuffer();
 144  44 buffer.append("Proposition:\n");
 145  44 buffer.append(getFormula());
 146  44 buffer.append("\nDescription:\n");
 147  44 buffer.append(getDescription());
 148  44 buffer.append("\nProof:\n");
 149  44 buffer.append(getProofList());
 150  44 return buffer.toString();
 151    }
 152   
 153    }