Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 203   Methods: 21
NCLOC: 101   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FunctionDefinitionVo.java 100% 86,7% 81% 87,7%
coverage coverage
 1    /* $Id: FunctionDefinitionVo.java,v 1.4 2007/05/10 00:37:50 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, 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.FunctionDefinition;
 22    import org.qedeq.kernel.base.module.LatexList;
 23    import org.qedeq.kernel.base.module.PredicateDefinition;
 24    import org.qedeq.kernel.base.module.Proposition;
 25    import org.qedeq.kernel.base.module.Rule;
 26    import org.qedeq.kernel.base.module.Term;
 27    import org.qedeq.kernel.base.module.VariableList;
 28    import org.qedeq.kernel.utility.EqualsUtility;
 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.4 $
 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  267 public FunctionDefinitionVo() {
 65    // nothing to do
 66    }
 67   
 68  0 public Axiom getAxiom() {
 69  0 return null;
 70    }
 71   
 72  0 public PredicateDefinition getPredicateDefinition() {
 73  0 return null;
 74    }
 75   
 76  2020 public FunctionDefinition getFunctionDefinition() {
 77  2020 return this;
 78    }
 79   
 80  0 public Proposition getProposition() {
 81  0 return null;
 82    }
 83   
 84  0 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  224 public final void setArgumentNumber(final String argumentNumber) {
 94  224 this.argumentNumber = argumentNumber;
 95    }
 96   
 97  733 public final String getArgumentNumber() {
 98  733 return argumentNumber;
 99    }
 100   
 101    /**
 102    * Set function name. Together with {@link #getArgumentNumber()} this
 103    * identifies a function.
 104    *
 105    * @param name
 106    */
 107  224 public void setName(final String name) {
 108  224 this.name = name;
 109    }
 110   
 111  759 public String getName() {
 112  759 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  224 public final void setLatexPattern(final String latexPattern) {
 123  224 this.latexPattern = latexPattern;
 124    }
 125   
 126  1363 public final String getLatexPattern() {
 127  1363 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  185 public final void setVariableList(final VariableListVo variables) {
 137  185 this.variableList = variables;
 138    }
 139   
 140  4848 public final VariableList getVariableList() {
 141  4848 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  224 public final void setTerm(final TermVo term) {
 150  224 this.term = term;
 151    }
 152   
 153  6033 public final Term getTerm() {
 154  6033 return term;
 155    }
 156   
 157    /**
 158    * Set description. Only necessary if formula is not self-explanatory.
 159    *
 160    * @param description Description.
 161    */
 162  16 public final void setDescription(final LatexListVo description) {
 163  16 this.description = description;
 164    }
 165   
 166  761 public LatexList getDescription() {
 167  761 return description;
 168    }
 169   
 170  81 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 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 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    }