Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
41   238   36   1.58
20   128   0.88   26
26     1.38  
1    
 
  RuleVo       Line # 37 41 36 100% 1.0
 
  (52)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.se.dto.module;
17   
18    import org.qedeq.base.utility.EqualsUtility;
19    import org.qedeq.kernel.se.base.module.Axiom;
20    import org.qedeq.kernel.se.base.module.ChangedRuleList;
21    import org.qedeq.kernel.se.base.module.FunctionDefinition;
22    import org.qedeq.kernel.se.base.module.InitialFunctionDefinition;
23    import org.qedeq.kernel.se.base.module.InitialPredicateDefinition;
24    import org.qedeq.kernel.se.base.module.LatexList;
25    import org.qedeq.kernel.se.base.module.LinkList;
26    import org.qedeq.kernel.se.base.module.PredicateDefinition;
27    import org.qedeq.kernel.se.base.module.ProofList;
28    import org.qedeq.kernel.se.base.module.Proposition;
29    import org.qedeq.kernel.se.base.module.Rule;
30   
31   
32    /**
33    * Rule declaration.
34    *
35    * @author Michael Meyling
36    */
 
37    public class RuleVo implements Rule {
38   
39    /** List of necessary ids. */
40    private LinkListVo linkList;
41   
42    /** Description. */
43    private LatexList description;
44   
45    /** Rule name. */
46    private String name;
47   
48    /** Rule version. */
49    private String version;
50   
51    /** This rule changes the list of following rules. */
52    private ChangedRuleListVo changedRuleList;
53   
54    /** Proofs for this rule. */
55    private ProofListVo proofList;
56   
57    /**
58    * Constructs a new rule declaration.
59    */
 
60  3538 toggle public RuleVo() {
61    // nothing to do
62    }
63   
 
64  1 toggle public Axiom getAxiom() {
65  1 return null;
66    }
67   
 
68  1 toggle public InitialPredicateDefinition getInitialPredicateDefinition() {
69  1 return null;
70    }
71   
 
72  1 toggle public PredicateDefinition getPredicateDefinition() {
73  1 return null;
74    }
75   
 
76  1 toggle public InitialFunctionDefinition getInitialFunctionDefinition() {
77  1 return null;
78    }
79   
 
80  1 toggle public FunctionDefinition getFunctionDefinition() {
81  1 return null;
82    }
83   
 
84  127 toggle public Proposition getProposition() {
85  127 return null;
86    }
87   
 
88  3679 toggle public Rule getRule() {
89  3679 return this;
90    }
91   
92    /**
93    * Set rule name.
94    *
95    * @param name Rule name.
96    */
 
97  3471 toggle public final void setName(final String name) {
98  3471 this.name = name;
99    }
100   
 
101  30730 toggle public final String getName() {
102  30730 return name;
103    }
104   
105    /**
106    * Set rule version.
107    *
108    * @param version Rule version.
109    */
 
110  3471 toggle public final void setVersion(final String version) {
111  3471 this.version = version;
112    }
113   
 
114  20207 toggle public final String getVersion() {
115  20207 return version;
116    }
117   
118    /**
119    * Set list of necessary ids.
120    *
121    * @param linkList List.
122    */
 
123  212 toggle public final void setLinkList(final LinkListVo linkList) {
124  212 this.linkList = linkList;
125    }
126   
 
127  8995 toggle public final LinkList getLinkList() {
128  8995 return linkList;
129    }
130   
131    /**
132    * Add link for this rule.
133    *
134    * @param id Id to add.
135    */
 
136  212 toggle public final void addLink(final String id) {
137  212 if (linkList == null) {
138  198 linkList = new LinkListVo();
139    }
140  212 linkList.add(id);
141    }
142   
143    /**
144    * Set description.
145    *
146    * @param description Description.
147    */
 
148  3473 toggle public final void setDescription(final LatexListVo description) {
149  3473 this.description = description;
150    }
151   
 
152  17748 toggle public LatexList getDescription() {
153  17748 return description;
154    }
155   
156    /**
157    * Set rule proof list.
158    *
159    * @param proofList Proof list.
160    */
 
161  29 toggle public final void setProofList(final ProofListVo proofList) {
162  29 this.proofList = proofList;
163    }
164   
 
165  8052 toggle public final ProofList getProofList() {
166  8052 return proofList;
167    }
168   
169    /**
170    * Add proof to this list.
171    *
172    * @param proof Proof to add.
173    */
 
174  16 toggle public final void addProof(final ProofVo proof) {
175  16 if (proofList == null) {
176  11 proofList = new ProofListVo();
177    }
178  16 proofList.add(proof);
179    }
180   
181    /**
182    * Set list of changed rules.
183    *
184    * @param changedRuleList List of changed rules.
185    */
 
186  29 toggle public final void setChangedRuleList(final ChangedRuleListVo changedRuleList) {
187  29 this.changedRuleList = changedRuleList;
188    }
189   
 
190  11980 toggle public final ChangedRuleList getChangedRuleList() {
191  11980 return changedRuleList;
192    }
193   
194    /**
195    * Add changed rule to this list.
196    *
197    * @param changedRule Changed rule to add.
198    */
 
199  79 toggle public final void addChangedRule(final ChangedRuleVo changedRule) {
200  79 if (changedRuleList == null) {
201  11 changedRuleList = new ChangedRuleListVo();
202    }
203  79 changedRuleList.add(changedRule);
204    }
205   
 
206  124 toggle public boolean equals(final Object obj) {
207  124 if (!(obj instanceof RuleVo)) {
208  11 return false;
209    }
210  113 final RuleVo other = (RuleVo) obj;
211  113 return EqualsUtility.equals(getName(), other.getName())
212    && EqualsUtility.equals(getVersion(), other.getVersion())
213    && EqualsUtility.equals(getLinkList(), other.getLinkList())
214    && EqualsUtility.equals(getDescription(), other.getDescription())
215    && EqualsUtility.equals(getChangedRuleList(), other.getChangedRuleList())
216    && EqualsUtility.equals(getProofList(), other.getProofList());
217    }
218   
 
219  108 toggle public int hashCode() {
220  108 return (getName() != null ? 1 ^ getName().hashCode() : 0)
221  108 ^ (getVersion() != null ? 2 ^ getVersion().hashCode() : 0)
222  108 ^ (getLinkList() != null ? 3 ^ getLinkList().hashCode() : 0)
223  108 ^ (getDescription() != null ? 4 ^ getDescription().hashCode() : 0)
224  108 ^ (getChangedRuleList() != null ? 5 ^ getChangedRuleList().hashCode() : 0)
225  108 ^ (getProofList() != null ? 6 ^ getProofList().hashCode() : 0);
226    }
227   
 
228  74 toggle public String toString() {
229  74 final StringBuffer buffer = new StringBuffer();
230  74 buffer.append("Rule: " + getName() + " [" + getVersion() + "]\n");
231  74 buffer.append(getLinkList());
232  74 buffer.append("\nDescription:\n");
233  74 buffer.append(getDescription());
234  74 buffer.append(getProofList());
235  74 buffer.append(getChangedRuleList());
236  74 return buffer.toString();
237    }
238    }