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