Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../img/srcFileCovDistChart9.png 30% of files have more coverage
30   207   22   1,43
14   101   0,73   21
21     1,05  
1    
 
  PredicateDefinitionVo       Line # 41 30 22 87,7% 0.8769231
 
  (29)
 
1    /* $Id: PredicateDefinitionVo.java,v 1.6 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.Formula;
23    import org.qedeq.kernel.base.module.FunctionDefinition;
24    import org.qedeq.kernel.base.module.LatexList;
25    import org.qedeq.kernel.base.module.PredicateDefinition;
26    import org.qedeq.kernel.base.module.Proposition;
27    import org.qedeq.kernel.base.module.Rule;
28    import org.qedeq.kernel.base.module.VariableList;
29   
30   
31    /**
32    * Definition of operator. This is a predicate constant. For example the
33    * predicate "x is a set" could be defined in MK with the formula "\exists y: x \in y".
34    * <p>
35    * There must also be the possibility to define basic predicate constants like
36    * "x is element of y".
37    *
38    * @version $Revision: 1.6 $
39    * @author Michael Meyling
40    */
 
41    public class PredicateDefinitionVo implements PredicateDefinition {
42   
43    /** Carries information about the argument number the defined object needs. */
44    private String argumentNumber;
45   
46    /** This name together with argumentNumber identifies a function. */
47    private String name;
48   
49    /** LaTeX pattern for definition visualisation. The replaceable arguments must are
50    * marked as <code>#1</code>, <code>#2</code> and so on. For example
51    * <code>\mathfrak{M}(#1)</code> */
52    private String latexPattern;
53   
54    /** List of formula or subject variables to be replaced in the LaTeX pattern.
55    * Could be <code>null</code>.*/
56    private VariableList variableList;
57   
58    /** Formula or term that defines the object. Could be <code>null</code>. */
59    private Formula formula;
60   
61    /** Further proposition description. Normally <code>null</code>. */
62    private LatexList description;
63   
64    /**
65    * Constructs a new definition.
66    */
 
67  590 toggle public PredicateDefinitionVo() {
68    // nothing to do
69    }
70   
 
71  0 toggle public Axiom getAxiom() {
72  0 return null;
73    }
74   
 
75  1766 toggle public PredicateDefinition getPredicateDefinition() {
76  1766 return this;
77    }
78   
 
79  0 toggle public FunctionDefinition getFunctionDefinition() {
80  0 return null;
81    }
82   
 
83  0 toggle public Proposition getProposition() {
84  0 return null;
85    }
86   
 
87  0 toggle public Rule getRule() {
88  0 return null;
89    }
90   
91    /**
92    * Set information about the argument number the defined object needs.
93    *
94    * @param argumentNumber Argument number information.
95    */
 
96  546 toggle public final void setArgumentNumber(final String argumentNumber) {
97  546 this.argumentNumber = argumentNumber;
98    }
99   
 
100  1801 toggle public final String getArgumentNumber() {
101  1801 return argumentNumber;
102    }
103   
104    /**
105    * Set predicate name. Together with {@link #getArgumentNumber()} this
106    * identifies a predicate.
107    *
108    * @param name
109    */
 
110  546 toggle public void setName(final String name) {
111  546 this.name = name;
112    }
113   
 
114  1835 toggle public String getName() {
115  1835 return name;
116    }
117   
118    /**
119    * Set LaTeX pattern for definition visualisation. The replaceable arguments are
120    * marked as <code>#1</code>, <code>#2</code> and so on. For example
121    * <code>\mathfrak{M}(#1)</code>.
122    *
123    * @param latexPattern LaTeX pattern for definition visualisation.
124    */
 
125  546 toggle public final void setLatexPattern(final String latexPattern) {
126  546 this.latexPattern = latexPattern;
127    }
128   
 
129  2823 toggle public final String getLatexPattern() {
130  2823 return latexPattern;
131    }
132   
133    /**
134    * Set list of formula or subject variables to be replaced in the LaTeX pattern.
135    * Could be <code>null</code>.
136    *
137    * @param variables Variable list for replacement.
138    */
 
139  474 toggle public final void setVariableList(final VariableListVo variables) {
140  474 this.variableList = variables;
141    }
142   
 
143  5973 toggle public final VariableList getVariableList() {
144  5973 return variableList;
145    }
146   
147    /**
148    * Set defining formula or term that defines the object. Could be <code>null</code>.
149    *
150    * @param formulaOrTerm Formula or term that defines the new operator.
151    */
 
152  413 toggle public final void setFormula(final FormulaVo formulaOrTerm) {
153  413 this.formula = formulaOrTerm;
154    }
155   
 
156  6387 toggle public final Formula getFormula() {
157  6387 return formula;
158    }
159   
160    /**
161    * Set description. Only necessary if formula is not self-explanatory.
162    *
163    * @param description Description.
164    */
 
165  113 toggle public final void setDescription(final LatexListVo description) {
166  113 this.description = description;
167    }
168   
 
169  1842 toggle public LatexList getDescription() {
170  1842 return description;
171    }
172   
 
173  222 toggle public boolean equals(final Object obj) {
174  222 if (!(obj instanceof PredicateDefinition)) {
175  10 return false;
176    }
177  212 final PredicateDefinition other = (PredicateDefinition) obj;
178  212 return EqualsUtility.equals(getArgumentNumber(), other.getArgumentNumber())
179    && EqualsUtility.equals(getName(), other.getName())
180    && EqualsUtility.equals(getLatexPattern(), other.getLatexPattern())
181    && EqualsUtility.equals(getVariableList(), other.getVariableList())
182    && EqualsUtility.equals(getFormula(), other.getFormula())
183    && EqualsUtility.equals(getDescription(), other.getDescription());
184    }
185   
 
186  223 toggle public int hashCode() {
187  223 return (getArgumentNumber() != null ? getArgumentNumber().hashCode() : 0)
188  223 ^ (getName() != null ? 1 ^ getName().hashCode() : 0)
189  223 ^ (getLatexPattern() != null ? 2 ^ getLatexPattern().hashCode() : 0)
190  223 ^ (getVariableList() != null ? 3 ^ getVariableList().hashCode() : 0)
191  223 ^ (getFormula() != null ? 4 ^ getFormula().hashCode() : 0)
192  223 ^ (getDescription() != null ? 5 ^ getDescription().hashCode() : 0);
193    }
194   
 
195  158 toggle public String toString() {
196  158 final StringBuffer buffer = new StringBuffer();
197  158 buffer.append("Predicate Definition arguments=" + getArgumentNumber() + "\n");
198  158 buffer.append("\tname=" + getName() + "\n");
199  158 buffer.append("\tpattern=" + getLatexPattern() + "\n");
200  158 buffer.append("\tvariables=" + getVariableList() + "\n");
201  158 buffer.append("\tformula/term:\n" + getFormula() + "\n");
202  158 buffer.append("\tdescription:\n" + getDescription() + "\n");
203  158 return buffer.toString();
204    }
205   
206   
207    }