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
PropositionVo.java 100% 88,5% 80% 88,2%
coverage coverage
 1    /* $Id: PropositionVo.java,v 1.6 2005/12/09 18:23:55 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.dto.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.6 $
 35    * @author Michael Meyling
 36    */
 37    public final class PropositionVo implements Proposition {
 38   
 39    /** Proposition formula. */
 40    private FormulaOrTerm 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  63 public PropositionVo() {
 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  8 public Proposition getProposition() {
 64  8 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  35 public final void setFormula(final FormulaOrTerm formula) {
 77  35 this.formula = formula;
 78    }
 79   
 80  263 public final FormulaOrTerm getFormula() {
 81  263 return formula;
 82    }
 83   
 84    /**
 85    * Set description. Only necessary if formula is not self-explanatory.
 86    *
 87    * @param description Description.
 88    */
 89  18 public final void setDescription(final LatexList description) {
 90  18 this.description = description;
 91    }
 92   
 93  234 public LatexList getDescription() {
 94  234 return description;
 95    }
 96   
 97    /**
 98    * Set proof list.
 99    *
 100    * @param proofList Proof list.
 101    */
 102  16 public final void setProofList(final ProofListVo proofList) {
 103  16 this.proofList = proofList;
 104    }
 105   
 106  233 public final ProofList getProofList() {
 107  233 return proofList;
 108    }
 109   
 110    /**
 111    * Add proof to this list.
 112    *
 113    * @param proof Proof to add.
 114    */
 115  25 public final void addProof(final Proof proof) {
 116  25 if (proofList == null) {
 117  20 proofList = new ProofListVo();
 118    }
 119  25 proofList.add(proof);
 120    }
 121   
 122  59 public boolean equals(final Object obj) {
 123  59 if (!(obj instanceof PropositionVo)) {
 124  6 return false;
 125    }
 126  53 final PropositionVo other = (PropositionVo) 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("\nDescription:\n");
 143  42 buffer.append(getDescription());
 144  42 buffer.append("\nProof:\n");
 145  42 buffer.append(getProofList());
 146  42 return buffer.toString();
 147    }
 148   
 149    }