Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 182   Methods: 19
NCLOC: 95   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
RuleVo.java 100% 87,5% 78,9% 87,7%
coverage coverage
 1    /* $Id: RuleVo.java,v 1.4 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.FunctionDefinition;
 22    import org.qedeq.kernel.base.module.LatexList;
 23    import org.qedeq.kernel.base.module.LinkList;
 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    * Rule declaration.
 33    *
 34    * @version $Revision: 1.4 $
 35    * @author Michael Meyling
 36    */
 37    public final class RuleVo implements Rule {
 38   
 39    /** List of necessary ids. */
 40    private LinkListVo linkList;
 41   
 42    /** Further proposition description. Normally <code>null</code>. */
 43    private LatexList description;
 44   
 45    /** Rule name. */
 46    private String name;
 47   
 48    /** Proofs for this rule. */
 49    private ProofListVo proofList;
 50   
 51    /**
 52    * Constructs a new rule declaration.
 53    */
 54  65 public RuleVo() {
 55    // nothing to do
 56    }
 57   
 58  0 public Axiom getAxiom() {
 59  0 return null;
 60    }
 61   
 62  0 public PredicateDefinition getPredicateDefinition() {
 63  0 return null;
 64    }
 65   
 66  0 public FunctionDefinition getFunctionDefinition() {
 67  0 return null;
 68    }
 69   
 70  0 public Proposition getProposition() {
 71  0 return null;
 72    }
 73   
 74  17 public Rule getRule() {
 75  17 return this;
 76    }
 77   
 78    /**
 79    * Set rule name.
 80    *
 81    * @param name Rule name.
 82    */
 83  28 public final void setName(final String name) {
 84  28 this.name = name;
 85    }
 86   
 87  363 public final String getName() {
 88  363 return name;
 89    }
 90   
 91    /**
 92    * Set list of necessary ids.
 93    *
 94    * @param linkList List.
 95    */
 96  19 public final void setLinkList(final LinkListVo linkList) {
 97  19 this.linkList = linkList;
 98    }
 99   
 100  310 public final LinkList getLinkList() {
 101  310 return linkList;
 102    }
 103   
 104    /**
 105    * Add link for this rule.
 106    *
 107    * @param id Id to add.
 108    */
 109  10 public final void addLink(final String id) {
 110  10 if (linkList == null) {
 111  5 linkList = new LinkListVo();
 112    }
 113  10 linkList.add(id);
 114    }
 115   
 116    /**
 117    * Set description. Only necessary if formula is not self-explanatory.
 118    *
 119    * @param description Description.
 120    */
 121  28 public final void setDescription(final LatexListVo description) {
 122  28 this.description = description;
 123    }
 124   
 125  319 public LatexList getDescription() {
 126  319 return description;
 127    }
 128   
 129    /**
 130    * Set rule proof list.
 131    *
 132    * @param proofList Proof list.
 133    */
 134  16 public final void setProofList(final ProofListVo proofList) {
 135  16 this.proofList = proofList;
 136    }
 137   
 138  286 public final ProofList getProofList() {
 139  286 return proofList;
 140    }
 141   
 142    /**
 143    * Add proof to this list.
 144    *
 145    * @param proof Proof to add.
 146    */
 147  7 public final void addProof(final ProofVo proof) {
 148  7 if (proofList == null) {
 149  2 proofList = new ProofListVo();
 150    }
 151  7 proofList.add(proof);
 152    }
 153   
 154  85 public boolean equals(final Object obj) {
 155  85 if (!(obj instanceof RuleVo)) {
 156  8 return false;
 157    }
 158  77 final RuleVo other = (RuleVo) obj;
 159  77 return EqualsUtility.equals(getName(), other.getName())
 160    && EqualsUtility.equals(getLinkList(), other.getLinkList())
 161    && EqualsUtility.equals(getDescription(), other.getDescription())
 162    && EqualsUtility.equals(getProofList(), other.getProofList());
 163    }
 164   
 165  76 public int hashCode() {
 166  76 return (getName() != null ? 1 ^ getName().hashCode() : 0)
 167  76 ^ (getLinkList() != null ? 1 ^ getLinkList().hashCode() : 0)
 168  76 ^ (getDescription() != null ? 2 ^ getDescription().hashCode() : 0)
 169  76 ^ (getProofList() != null ? 2 ^ getProofList().hashCode() : 0);
 170    }
 171   
 172  54 public String toString() {
 173  54 final StringBuffer buffer = new StringBuffer();
 174  54 buffer.append("Rule: " + getName() + "\n");
 175  54 buffer.append(getLinkList());
 176  54 buffer.append("\nDescription:\n");
 177  54 buffer.append(getDescription());
 178  54 buffer.append("\nProof:\n");
 179  54 buffer.append(getProofList());
 180  54 return buffer.toString();
 181    }
 182    }