Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
32   182   22   1,68
14   95   0,69   19
19     1,16  
1    
 
  RuleVo       Line # 37 32 22 87,7% 0.8769231
 
  (9)
 
1    /* $Id: RuleVo.java,v 1.9 2008/07/26 07:59:35 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, 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.base.utility.EqualsUtility;
21    import org.qedeq.kernel.base.module.Axiom;
22    import org.qedeq.kernel.base.module.FunctionDefinition;
23    import org.qedeq.kernel.base.module.LatexList;
24    import org.qedeq.kernel.base.module.LinkList;
25    import org.qedeq.kernel.base.module.PredicateDefinition;
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   
30   
31    /**
32    * Rule declaration.
33    *
34    * @version $Revision: 1.9 $
35    * @author Michael Meyling
36    */
 
37    public 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  284 toggle public RuleVo() {
55    // nothing to do
56    }
57   
 
58  0 toggle public Axiom getAxiom() {
59  0 return null;
60    }
61   
 
62  0 toggle public PredicateDefinition getPredicateDefinition() {
63  0 return null;
64    }
65   
 
66  0 toggle public FunctionDefinition getFunctionDefinition() {
67  0 return null;
68    }
69   
 
70  0 toggle public Proposition getProposition() {
71  0 return null;
72    }
73   
 
74  202 toggle public Rule getRule() {
75  202 return this;
76    }
77   
78    /**
79    * Set rule name.
80    *
81    * @param name Rule name.
82    */
 
83  247 toggle public final void setName(final String name) {
84  247 this.name = name;
85    }
86   
 
87  827 toggle public final String getName() {
88  827 return name;
89    }
90   
91    /**
92    * Set list of necessary ids.
93    *
94    * @param linkList List.
95    */
 
96  23 toggle public final void setLinkList(final LinkListVo linkList) {
97  23 this.linkList = linkList;
98    }
99   
 
100  1046 toggle public final LinkList getLinkList() {
101  1046 return linkList;
102    }
103   
104    /**
105    * Add link for this rule.
106    *
107    * @param id Id to add.
108    */
 
109  15 toggle public final void addLink(final String id) {
110  15 if (linkList == null) {
111  10 linkList = new LinkListVo();
112    }
113  15 linkList.add(id);
114    }
115   
116    /**
117    * Set description. Only necessary if formula is not self-explanatory.
118    *
119    * @param description Description.
120    */
 
121  247 toggle public final void setDescription(final LatexListVo description) {
122  247 this.description = description;
123    }
124   
 
125  1811 toggle public LatexList getDescription() {
126  1811 return description;
127    }
128   
129    /**
130    * Set rule proof list.
131    *
132    * @param proofList Proof list.
133    */
 
134  16 toggle public final void setProofList(final ProofListVo proofList) {
135  16 this.proofList = proofList;
136    }
137   
 
138  883 toggle public final ProofList getProofList() {
139  883 return proofList;
140    }
141   
142    /**
143    * Add proof to this list.
144    *
145    * @param proof Proof to add.
146    */
 
147  7 toggle 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 toggle 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 toggle 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 toggle 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    }