Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
29   189   27   1.38
12   98   0.93   21
21     1.29  
1    
 
  PredicateDefinitionVo       Line # 36 29 27 100% 1.0
 
  (119)
 
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.Formula;
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.PredicateDefinition;
26    import org.qedeq.kernel.se.base.module.Proposition;
27    import org.qedeq.kernel.se.base.module.Rule;
28   
29   
30    /**
31    * Definition of operator. This is a predicate constant. For example the
32    * predicate "x is a set" could be defined in MK with the formula "\exists y: x \in y".
33    *
34    * @author Michael Meyling
35    */
 
36    public class PredicateDefinitionVo implements PredicateDefinition {
37   
38    /** Carries information about the argument number the defined object needs. */
39    private String argumentNumber;
40   
41    /** This name together with argumentNumber identifies a function. */
42    private String name;
43   
44    /** LaTeX pattern for definition visualisation. The replaceable arguments must are
45    * marked as <code>#1</code>, <code>#2</code> and so on. For example
46    * <code>\mathfrak{M}(#1)</code> */
47    private String latexPattern;
48   
49    /** Formula that defines the object.*/
50    private Formula formula;
51   
52    /** Further proposition description. Normally <code>null</code>. */
53    private LatexList description;
54   
55    /**
56    * Constructs a new definition.
57    */
 
58  8069 toggle public PredicateDefinitionVo() {
59    // nothing to do
60    }
61   
 
62  1 toggle public Axiom getAxiom() {
63  1 return null;
64    }
65   
 
66  1 toggle public InitialPredicateDefinition getInitialPredicateDefinition() {
67  1 return null;
68    }
69   
 
70  279971 toggle public PredicateDefinition getPredicateDefinition() {
71  279971 return this;
72    }
73   
 
74  1 toggle public InitialFunctionDefinition getInitialFunctionDefinition() {
75  1 return null;
76    }
77   
 
78  1 toggle public FunctionDefinition getFunctionDefinition() {
79  1 return null;
80    }
81   
 
82  1 toggle public Proposition getProposition() {
83  1 return null;
84    }
85   
 
86  1 toggle public Rule getRule() {
87  1 return null;
88    }
89   
90    /**
91    * Set information about the argument number the defined object needs.
92    *
93    * @param argumentNumber Argument number information.
94    */
 
95  8018 toggle public final void setArgumentNumber(final String argumentNumber) {
96  8018 this.argumentNumber = argumentNumber;
97    }
98   
 
99  5987 toggle public final String getArgumentNumber() {
100  5987 return argumentNumber;
101    }
102   
103    /**
104    * Set predicate name. Together with {@link #getArgumentNumber()} this
105    * identifies a predicate.
106    *
107    * @param name Predicate name.
108    */
 
109  8018 toggle public void setName(final String name) {
110  8018 this.name = name;
111    }
112   
 
113  6606 toggle public String getName() {
114  6606 return name;
115    }
116   
117    /**
118    * Set LaTeX pattern for definition visualisation. The replaceable arguments are
119    * marked as <code>#1</code>, <code>#2</code> and so on. For example
120    * <code>\mathfrak{M}(#1)</code>.
121    *
122    * @param latexPattern LaTeX pattern for definition visualisation.
123    */
 
124  8018 toggle public final void setLatexPattern(final String latexPattern) {
125  8018 this.latexPattern = latexPattern;
126    }
127   
 
128  6376 toggle public final String getLatexPattern() {
129  6376 return latexPattern;
130    }
131   
132    /**
133    * Set defining formula or term that defines the object. Could be <code>null</code>.
134    *
135    * @param formulaOrTerm Formula or term that defines the new operator.
136    */
 
137  2666 toggle public final void setFormula(final FormulaVo formulaOrTerm) {
138  2666 this.formula = formulaOrTerm;
139    }
140   
 
141  290985 toggle public final Formula getFormula() {
142  290985 return formula;
143    }
144   
145    /**
146    * Set description. Only necessary if formula is not self-explanatory.
147    *
148    * @param description Description.
149    */
 
150  115 toggle public final void setDescription(final LatexListVo description) {
151  115 this.description = description;
152    }
153   
 
154  5159 toggle public LatexList getDescription() {
155  5159 return description;
156    }
157   
 
158  241 toggle public boolean equals(final Object obj) {
159  241 if (!(obj instanceof PredicateDefinition)) {
160  9 return false;
161    }
162  232 final PredicateDefinition other = (PredicateDefinition) obj;
163  232 return EqualsUtility.equals(getArgumentNumber(), other.getArgumentNumber())
164    && EqualsUtility.equals(getName(), other.getName())
165    && EqualsUtility.equals(getLatexPattern(), other.getLatexPattern())
166    && EqualsUtility.equals(getFormula(), other.getFormula())
167    && EqualsUtility.equals(getDescription(), other.getDescription());
168    }
169   
 
170  353 toggle public int hashCode() {
171  353 return (getArgumentNumber() != null ? getArgumentNumber().hashCode() : 0)
172  353 ^ (getName() != null ? 1 ^ getName().hashCode() : 0)
173  353 ^ (getLatexPattern() != null ? 2 ^ getLatexPattern().hashCode() : 0)
174  353 ^ (getFormula() != null ? 4 ^ getFormula().hashCode() : 0)
175  353 ^ (getDescription() != null ? 5 ^ getDescription().hashCode() : 0);
176    }
177   
 
178  270 toggle public String toString() {
179  270 final StringBuffer buffer = new StringBuffer();
180  270 buffer.append("Predicate Definition arguments=" + getArgumentNumber() + "\n");
181  270 buffer.append("\tname=" + getName() + "\n");
182  270 buffer.append("\tpattern=" + getLatexPattern() + "\n");
183  270 buffer.append("\tformula:\n" + getFormula() + "\n");
184  270 buffer.append("\tdescription:\n" + getDescription() + "\n");
185  270 return buffer.toString();
186    }
187   
188   
189    }