Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 200   Methods: 20
NCLOC: 96   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DefinitionVo.java 100% 89,3% 85% 90,3%
coverage coverage
 1    /* $Id: DefinitionVo.java,v 1.7 2005/12/09 18:23:55 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2005, 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.kernel.base.module.Axiom;
 21    import org.qedeq.kernel.base.module.Definition;
 22    import org.qedeq.kernel.base.module.FormulaOrTerm;
 23    import org.qedeq.kernel.base.module.LatexList;
 24    import org.qedeq.kernel.base.module.Proposition;
 25    import org.qedeq.kernel.base.module.Rule;
 26    import org.qedeq.kernel.base.module.VariableList;
 27    import org.qedeq.kernel.utility.EqualsUtility;
 28   
 29   
 30    /**
 31    * Definition of operator. This might be a predicate or function constant. For example
 32    * the predicate "x is a set" could be defined in MK with the formulaOrTerm
 33    * <code>\exists y: x \in y</code>.
 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.7 $
 39    * @author Michael Meyling
 40    */
 41    public final class DefinitionVo implements Definition {
 42   
 43    /** Definition type. For example: this a predicate definition, a function definition. */
 44    private String type;
 45   
 46    /** Carries information about the argument number the defined object needs. */
 47    private String argumentNumber;
 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 FormulaOrTerm formulaOrTerm;
 60   
 61    /** Further proposition description. Normally <code>null</code>. */
 62    private LatexList description;
 63   
 64    /**
 65    * Constructs a new definition.
 66    */
 67  189 public DefinitionVo() {
 68    // nothing to do
 69    }
 70   
 71  0 public Axiom getAxiom() {
 72  0 return null;
 73    }
 74   
 75  30 public Definition getDefinition() {
 76  30 return this;
 77    }
 78   
 79  0 public Proposition getProposition() {
 80  0 return null;
 81    }
 82   
 83  0 public Rule getRule() {
 84  0 return null;
 85    }
 86   
 87    /**
 88    * Set definition type. For example: this a predicate definition, a function definition.
 89    *
 90    * @param type Definition type.
 91    */
 92  147 public final void setType(final String type) {
 93  147 this.type = type;
 94    }
 95   
 96  897 public final String getType() {
 97  897 return type;
 98    }
 99   
 100    /**
 101    * Set information about the argument number the defined object needs.
 102    *
 103    * @param argumentNumber Argument number information.
 104    */
 105  147 public final void setArgumentNumber(final String argumentNumber) {
 106  147 this.argumentNumber = argumentNumber;
 107    }
 108   
 109  879 public final String getArgumentNumber() {
 110  879 return argumentNumber;
 111    }
 112   
 113    /**
 114    * Set LaTeX pattern for definition visualisation. The replaceable arguments are
 115    * marked as <code>#1</code>, <code>#2</code> and so on. For example
 116    * <code>\mathfrak{M}(#1)</code>.
 117    *
 118    * @param latexPattern LaTeX pattern for definition visualisation.
 119    */
 120  147 public final void setLatexPattern(final String latexPattern) {
 121  147 this.latexPattern = latexPattern;
 122    }
 123   
 124  883 public final String getLatexPattern() {
 125  883 return latexPattern;
 126    }
 127   
 128    /**
 129    * Set list of formula or subject variables to be replaced in the LaTeX pattern.
 130    * Could be <code>null</code>.
 131    *
 132    * @param variables Variable list for replacement.
 133    */
 134  141 public final void setVariableList(final VariableList variables) {
 135  141 this.variableList = variables;
 136    }
 137   
 138  853 public final VariableList getVariableList() {
 139  853 return variableList;
 140    }
 141   
 142    /**
 143    * Set defining formula or term that defines the object. Could be <code>null</code>.
 144    *
 145    * @param formulaOrTerm Formula or term that defines the new operator.
 146    */
 147  128 public final void setFormulaOrTerm(final FormulaOrTerm formulaOrTerm) {
 148  128 this.formulaOrTerm = formulaOrTerm;
 149    }
 150   
 151  824 public final FormulaOrTerm getFormulaOrTerm() {
 152  824 return formulaOrTerm;
 153    }
 154   
 155    /**
 156    * Set description. Only necessary if formula is not self-explanatory.
 157    *
 158    * @param description Description.
 159    */
 160  113 public final void setDescription(final LatexList description) {
 161  113 this.description = description;
 162    }
 163   
 164  851 public LatexList getDescription() {
 165  851 return description;
 166    }
 167   
 168  191 public boolean equals(final Object obj) {
 169  191 if (!(obj instanceof Definition)) {
 170  10 return false;
 171    }
 172  181 final Definition other = (Definition) obj;
 173  181 return EqualsUtility.equals(getType(), other.getType())
 174    && EqualsUtility.equals(getArgumentNumber(), other.getArgumentNumber())
 175    && EqualsUtility.equals(getLatexPattern(), other.getLatexPattern())
 176    && EqualsUtility.equals(getVariableList(), other.getVariableList())
 177    && EqualsUtility.equals(getFormulaOrTerm(), other.getFormulaOrTerm())
 178    && EqualsUtility.equals(getDescription(), other.getDescription());
 179    }
 180   
 181  199 public int hashCode() {
 182  199 return (getType() != null ? getType().hashCode() : 0)
 183  199 ^ (getArgumentNumber() != null ? getArgumentNumber().hashCode() : 0)
 184  199 ^ (getLatexPattern() != null ? 1 ^ getLatexPattern().hashCode() : 0)
 185  199 ^ (getVariableList() != null ? 2 ^ getVariableList().hashCode() : 0)
 186  199 ^ (getFormulaOrTerm() != null ? 3 ^ getFormulaOrTerm().hashCode() : 0)
 187  199 ^ (getDescription() != null ? 4 ^ getDescription().hashCode() : 0);
 188    }
 189   
 190  146 public String toString() {
 191  146 final StringBuffer buffer = new StringBuffer();
 192  146 buffer.append("Definition Type=" + getType() + " arguments=" + getArgumentNumber() + "\n");
 193  146 buffer.append("\tpattern=" + getLatexPattern() + "\n");
 194  146 buffer.append("\tvariables=" + getVariableList() + "\n");
 195  146 buffer.append("\tformula/term:\n" + getFormulaOrTerm() + "\n");
 196  146 buffer.append("\tdescription:\n" + getDescription() + "\n");
 197  146 return buffer.toString();
 198    }
 199   
 200    }