Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
29   190   27   1.38
12   98   0.93   21
21     1.29  
1    
 
  InitialPredicateDefinitionVo       Line # 36 29 27 100% 1.0
 
  (53)
 
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.list.Element;
20    import org.qedeq.kernel.se.base.module.Axiom;
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 initial operator. This is a given predicate constant. For example:
32    * "x is element of y".
33    *
34    * @author Michael Meyling
35    */
 
36    public class InitialPredicateDefinitionVo implements InitialPredicateDefinition {
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    /** Predicate constant with free subject variables.*/
50    private Element predCon;
51   
52    /** Further operator description. Normally <code>null</code>. */
53    private LatexList description;
54   
55    /**
56    * Constructs a new definition.
57    */
 
58  792 toggle public InitialPredicateDefinitionVo() {
59    // nothing to do
60    }
61   
 
62  1 toggle public Axiom getAxiom() {
63  1 return null;
64    }
65   
 
66  344 toggle public InitialPredicateDefinition getInitialPredicateDefinition() {
67  344 return this;
68    }
69   
 
70  1 toggle public PredicateDefinition getPredicateDefinition() {
71  1 return null;
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  743 toggle public final void setArgumentNumber(final String argumentNumber) {
96  743 this.argumentNumber = argumentNumber;
97    }
98   
 
99  1557 toggle public final String getArgumentNumber() {
100  1557 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  743 toggle public void setName(final String name) {
110  743 this.name = name;
111    }
112   
 
113  1515 toggle public String getName() {
114  1515 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  743 toggle public final void setLatexPattern(final String latexPattern) {
125  743 this.latexPattern = latexPattern;
126    }
127   
 
128  1123 toggle public final String getLatexPattern() {
129  1123 return latexPattern;
130    }
131   
132    /**
133    * Set new predicate constant with free subject variables. The predicate constant must
134    * match {@link #getName()} and {@link #getArgumentNumber()}.
135    *
136    * @param predCon Predicate constant with free subject variables.
137    */
 
138  745 toggle public final void setPredCon(final Element predCon) {
139  745 this.predCon = predCon;
140    }
141   
 
142  2926 toggle public final Element getPredCon() {
143  2926 return predCon;
144    }
145   
146    /**
147    * Set description. Only necessary if formula is not self-explanatory.
148    *
149    * @param description Description.
150    */
 
151  18 toggle public final void setDescription(final LatexListVo description) {
152  18 this.description = description;
153    }
154   
 
155  1440 toggle public LatexList getDescription() {
156  1440 return description;
157    }
158   
 
159  70 toggle public boolean equals(final Object obj) {
160  70 if (!(obj instanceof InitialPredicateDefinition)) {
161  7 return false;
162    }
163  63 final InitialPredicateDefinition other = (InitialPredicateDefinition) obj;
164  63 return EqualsUtility.equals(getArgumentNumber(), other.getArgumentNumber())
165    && EqualsUtility.equals(getName(), other.getName())
166    && EqualsUtility.equals(getLatexPattern(), other.getLatexPattern())
167    && EqualsUtility.equals(getPredCon(), other.getPredCon())
168    && EqualsUtility.equals(getDescription(), other.getDescription());
169    }
170   
 
171  84 toggle public int hashCode() {
172  84 return (getArgumentNumber() != null ? getArgumentNumber().hashCode() : 0)
173  84 ^ (getName() != null ? 1 ^ getName().hashCode() : 0)
174  84 ^ (getLatexPattern() != null ? 2 ^ getLatexPattern().hashCode() : 0)
175  84 ^ (getPredCon() != null ? 3 ^ getPredCon().hashCode() : 0)
176  84 ^ (getDescription() != null ? 5 ^ getDescription().hashCode() : 0);
177    }
178   
 
179  56 toggle public String toString() {
180  56 final StringBuffer buffer = new StringBuffer();
181  56 buffer.append("Initial Predicate Definition arguments=" + getArgumentNumber() + "\n");
182  56 buffer.append("\tname=" + getName() + "\n");
183  56 buffer.append("\tpattern=" + getLatexPattern() + "\n");
184  56 buffer.append("\tpredCon=" + getPredCon() + "\n");
185  56 buffer.append("\tdescription:\n" + getDescription() + "\n");
186  56 return buffer.toString();
187    }
188   
189   
190    }