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