Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 207   Methods: 21
NCLOC: 101   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PredicateDefinitionVo.java 100% 86,7% 81% 87,7%
coverage coverage
 1    /* $Id: PredicateDefinitionVo.java,v 1.1 2006/10/20 20:23:01 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.Formula;
 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.VariableList;
 28    import org.qedeq.kernel.utility.EqualsUtility;
 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.1 $
 39    * @author Michael Meyling
 40    */
 41    public final 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  309 public PredicateDefinitionVo() {
 68    // nothing to do
 69    }
 70   
 71  0 public Axiom getAxiom() {
 72  0 return null;
 73    }
 74   
 75  153 public PredicateDefinition getPredicateDefinition() {
 76  153 return this;
 77    }
 78   
 79  0 public FunctionDefinition getFunctionDefinition() {
 80  0 return null;
 81    }
 82   
 83  0 public Proposition getProposition() {
 84  0 return null;
 85    }
 86   
 87  0 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  265 public final void setArgumentNumber(final String argumentNumber) {
 97  265 this.argumentNumber = argumentNumber;
 98    }
 99   
 100  1201 public final String getArgumentNumber() {
 101  1201 return argumentNumber;
 102    }
 103   
 104    /**
 105    * Set predicate name. Together with {@link #getArgumentNumber()} this
 106    * identifies a predicate.
 107    *
 108    * @param name
 109    */
 110  265 public void setName(final String name) {
 111  265 this.name = name;
 112    }
 113   
 114  1235 public String getName() {
 115  1235 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  265 public final void setLatexPattern(final String latexPattern) {
 126  265 this.latexPattern = latexPattern;
 127    }
 128   
 129  1737 public final String getLatexPattern() {
 130  1737 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  225 public final void setVariableList(final VariableListVo variables) {
 140  225 this.variableList = variables;
 141    }
 142   
 143  1199 public final VariableList getVariableList() {
 144  1199 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  199 public final void setFormula(final FormulaVo formulaOrTerm) {
 153  199 this.formula = formulaOrTerm;
 154    }
 155   
 156  1288 public final Formula getFormula() {
 157  1288 return formula;
 158    }
 159   
 160    /**
 161    * Set description. Only necessary if formula is not self-explanatory.
 162    *
 163    * @param description Description.
 164    */
 165  125 public final void setDescription(final LatexListVo description) {
 166  125 this.description = description;
 167    }
 168   
 169  1099 public LatexList getDescription() {
 170  1099 return description;
 171    }
 172   
 173  238 public boolean equals(final Object obj) {
 174  238 if (!(obj instanceof PredicateDefinition)) {
 175  10 return false;
 176    }
 177  228 final PredicateDefinition other = (PredicateDefinition) obj;
 178  228 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  233 public int hashCode() {
 187  233 return (getArgumentNumber() != null ? getArgumentNumber().hashCode() : 0)
 188  233 ^ (getName() != null ? 1 ^ getName().hashCode() : 0)
 189  233 ^ (getLatexPattern() != null ? 2 ^ getLatexPattern().hashCode() : 0)
 190  233 ^ (getVariableList() != null ? 3 ^ getVariableList().hashCode() : 0)
 191  233 ^ (getFormula() != null ? 4 ^ getFormula().hashCode() : 0)
 192  233 ^ (getDescription() != null ? 5 ^ getDescription().hashCode() : 0);
 193    }
 194   
 195  180 public String toString() {
 196  180 final StringBuffer buffer = new StringBuffer();
 197  180 buffer.append("Predicate Definition arguments=" + getArgumentNumber() + "\n");
 198  180 buffer.append("\tname=" + getName() + "\n");
 199  180 buffer.append("\tpattern=" + getLatexPattern() + "\n");
 200  180 buffer.append("\tvariables=" + getVariableList() + "\n");
 201  180 buffer.append("\tformula/term:\n" + getFormula() + "\n");
 202  180 buffer.append("\tdescription:\n" + getDescription() + "\n");
 203  180 return buffer.toString();
 204    }
 205   
 206   
 207    }