Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 178   Methods: 18
NCLOC: 92   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
RuleVo.java 100% 87,1% 77,8% 87,3%
coverage coverage
 1    /* $Id: RuleVo.java,v 1.3 2005/12/10 08:11:37 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.LatexList;
 23    import org.qedeq.kernel.base.module.LinkList;
 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    * Rule declaration.
 33    *
 34    * @version $Revision: 1.3 $
 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  53 public RuleVo() {
 55    // nothing to do
 56    }
 57   
 58  0 public Axiom getAxiom() {
 59  0 return null;
 60    }
 61   
 62  0 public Definition getDefinition() {
 63  0 return null;
 64    }
 65   
 66  0 public Proposition getProposition() {
 67  0 return null;
 68    }
 69   
 70  0 public Rule getRule() {
 71  0 return this;
 72    }
 73   
 74    /**
 75    * Set rule name.
 76    *
 77    * @param name Rule name.
 78    */
 79  16 public final void setName(final String name) {
 80  16 this.name = name;
 81    }
 82   
 83  337 public final String getName() {
 84  337 return name;
 85    }
 86   
 87    /**
 88    * Set list of necessary ids.
 89    *
 90    * @param linkList List.
 91    */
 92  16 public final void setLinkList(final LinkListVo linkList) {
 93  16 this.linkList = linkList;
 94    }
 95   
 96  292 public final LinkList getLinkList() {
 97  292 return linkList;
 98    }
 99   
 100    /**
 101    * Add link for this rule.
 102    *
 103    * @param id Id to add.
 104    */
 105  11 public final void addLink(final String id) {
 106  11 if (linkList == null) {
 107  4 linkList = new LinkListVo();
 108    }
 109  11 linkList.add(id);
 110    }
 111   
 112    /**
 113    * Set description. Only necessary if formula is not self-explanatory.
 114    *
 115    * @param description Description.
 116    */
 117  18 public final void setDescription(final LatexList description) {
 118  18 this.description = description;
 119    }
 120   
 121  287 public LatexList getDescription() {
 122  287 return description;
 123    }
 124   
 125    /**
 126    * Set rule proof list.
 127    *
 128    * @param proofList Proof list.
 129    */
 130  16 public final void setProofList(final ProofListVo proofList) {
 131  16 this.proofList = proofList;
 132    }
 133   
 134  270 public final ProofList getProofList() {
 135  270 return proofList;
 136    }
 137   
 138    /**
 139    * Add proof to this list.
 140    *
 141    * @param proof Proof to add.
 142    */
 143  7 public final void addProof(final Proof proof) {
 144  7 if (proofList == null) {
 145  2 proofList = new ProofListVo();
 146    }
 147  7 proofList.add(proof);
 148    }
 149   
 150  85 public boolean equals(final Object obj) {
 151  85 if (!(obj instanceof RuleVo)) {
 152  8 return false;
 153    }
 154  77 final RuleVo other = (RuleVo) obj;
 155  77 return EqualsUtility.equals(getName(), other.getName())
 156    && EqualsUtility.equals(getLinkList(), other.getLinkList())
 157    && EqualsUtility.equals(getDescription(), other.getDescription())
 158    && EqualsUtility.equals(getProofList(), other.getProofList());
 159    }
 160   
 161  74 public int hashCode() {
 162  74 return (getName() != null ? 1 ^ getName().hashCode() : 0)
 163  74 ^ (getLinkList() != null ? 1 ^ getLinkList().hashCode() : 0)
 164  74 ^ (getDescription() != null ? 2 ^ getDescription().hashCode() : 0)
 165  74 ^ (getProofList() != null ? 2 ^ getProofList().hashCode() : 0);
 166    }
 167   
 168  52 public String toString() {
 169  52 final StringBuffer buffer = new StringBuffer();
 170  52 buffer.append("Rule: " + getName() + "\n");
 171  52 buffer.append(getLinkList());
 172  52 buffer.append("\nDescription:\n");
 173  52 buffer.append(getDescription());
 174  52 buffer.append("\nProof:\n");
 175  52 buffer.append(getProofList());
 176  52 return buffer.toString();
 177    }
 178    }