Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 173   Methods: 18
NCLOC: 90   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
RuleBo.java 100% 83,3% 72,2% 83,3%
coverage coverage
 1    /* $Id: RuleBo.java,v 1.4 2006/10/20 20:23:00 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.bo.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.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 RuleBo implements Rule {
 38   
 39    /** Rule name. */
 40    private String name;
 41   
 42    /** List of necessary ids. */
 43    private LinkListBo linkList;
 44   
 45    /** Further proposition description. Normally <code>null</code>. */
 46    private LatexList description;
 47   
 48    /** Proofs for this rule. */
 49    private ProofList proofList;
 50   
 51    /**
 52    * Constructs a new proposition.
 53    */
 54  57 public RuleBo() {
 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  0 public Rule getRule() {
 75  0 return this;
 76    }
 77   
 78    /**
 79    * Set id list.
 80    *
 81    * @param linkList Link list.
 82    */
 83  19 public final void setLinkList(final LinkListBo linkList) {
 84  19 this.linkList = linkList;
 85    }
 86   
 87  250 public final LinkList getLinkList() {
 88  250 return linkList;
 89    }
 90   
 91    /**
 92    * Set rule proof list.
 93    *
 94    * @param proofList Proof list.
 95    */
 96  16 public final void setProofList(final ProofListBo proofList) {
 97  16 this.proofList = proofList;
 98    }
 99   
 100  237 public final ProofList getProofList() {
 101  237 return proofList;
 102    }
 103   
 104    /**
 105    * Set rule name.
 106    *
 107    * @param name Rule name.
 108    */
 109  22 public final void setName(final String name) {
 110  22 this.name = name;
 111    }
 112   
 113  305 public final String getName() {
 114  305 return name;
 115    }
 116   
 117    /**
 118    * Add link for this rule.
 119    *
 120    * @param id Id to add.
 121    */
 122  7 public final void addLink(final String id) {
 123  7 if (linkList == null) {
 124  2 linkList = new LinkListBo();
 125    }
 126  7 linkList.add(id);
 127    }
 128   
 129    /**
 130    * Set description. Only necessary if formula is not self-explanatory.
 131    *
 132    * @param description Description.
 133    */
 134  22 public final void setDescription(final LatexList description) {
 135  22 this.description = description;
 136    }
 137   
 138  279 public LatexList getDescription() {
 139  279 return description;
 140    }
 141   
 142   
 143  71 public boolean equals(final Object obj) {
 144  71 if (!(obj instanceof RuleBo)) {
 145  7 return false;
 146    }
 147  64 final RuleBo other = (RuleBo) obj;
 148  64 return EqualsUtility.equals(getName(), other.getName())
 149    && EqualsUtility.equals(getDescription(), other.getDescription())
 150    && EqualsUtility.equals(getLinkList(), other.getLinkList())
 151    && EqualsUtility.equals(getProofList(), other.getProofList());
 152    }
 153   
 154  72 public int hashCode() {
 155  72 return (getName() != null ? getName().hashCode() : 0)
 156  72 ^ (getLinkList() != null ? 1 ^ getLinkList().hashCode() : 0)
 157  72 ^ (getDescription() != null ? 1 ^ getDescription().hashCode() : 0)
 158  72 ^ (getProofList() != null ? 1 ^ getProofList().hashCode() : 0);
 159    }
 160   
 161  50 public String toString() {
 162  50 final StringBuffer buffer = new StringBuffer();
 163  50 buffer.append("Rule: " + getName() + "\n");
 164  50 buffer.append("Links:\n");
 165  50 buffer.append(getLinkList());
 166  50 buffer.append("Description:\n");
 167  50 buffer.append(getDescription());
 168  50 buffer.append("Proofs:\n");
 169  50 buffer.append(getProofList());
 170  50 return buffer.toString();
 171    }
 172   
 173    }