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