Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 196   Methods: 18
NCLOC: 98   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
HeaderVo.java 100% 100% 100% 100%
coverage
 1    /* $Id: HeaderVo.java,v 1.4 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.AuthorList;
 21    import org.qedeq.kernel.base.module.Header;
 22    import org.qedeq.kernel.base.module.ImportList;
 23    import org.qedeq.kernel.base.module.LatexList;
 24    import org.qedeq.kernel.base.module.Specification;
 25    import org.qedeq.kernel.base.module.UsedByList;
 26    import org.qedeq.kernel.utility.EqualsUtility;
 27   
 28   
 29    /**
 30    * Header of a qedeq file. The header specifies such things as the location of the file,
 31    * the title and abstract of that module, imports and exports.
 32    *
 33    * @version $Revision: 1.4 $
 34    * @author Michael Meyling
 35    */
 36    public final class HeaderVo implements Header {
 37   
 38    /** Module specification. */
 39    private Specification specification;
 40   
 41    /** Module title. */
 42    private LatexList title;
 43   
 44    /** Module "abstract". */
 45    private LatexList summary;
 46   
 47    /** Author list. */
 48    private AuthorList authorList;
 49   
 50    /** List of imported modules. */
 51    private ImportList importList;
 52   
 53    /** List of modules that depend on current one. */
 54    private UsedByList usedByList;
 55   
 56    /** Email address of module administrator. */
 57    private String email;
 58   
 59    /**
 60    * Constructs a new module header.
 61    */
 62  118 public HeaderVo() {
 63    // nothing to do
 64    }
 65   
 66    /**
 67    * Set module specification.
 68    * @param specification Module specification.
 69    */
 70  80 public final void setSpecification(final SpecificationVo specification) {
 71  80 this.specification = specification;
 72    }
 73   
 74  749 public final Specification getSpecification() {
 75  749 return specification;
 76    }
 77   
 78    /**
 79    * Set module title.
 80    *
 81    * @param title Module title texts.
 82    */
 83  80 public final void setTitle(final LatexListVo title) {
 84  80 this.title = title;
 85    }
 86   
 87  719 public final LatexList getTitle() {
 88  719 return title;
 89    }
 90   
 91    /**
 92    * Set module summary text.
 93    *
 94    * @param summary Module summary text.
 95    */
 96  80 public final void setSummary(final LatexListVo summary) {
 97  80 this.summary = summary;
 98    }
 99   
 100  677 public final LatexList getSummary() {
 101  677 return summary;
 102    }
 103   
 104    /**
 105    * Set list of authors of this module.
 106    *
 107    * @param authors Author list.
 108    */
 109  80 public final void setAuthorList(final AuthorListVo authors) {
 110  80 this.authorList = authors;
 111    }
 112   
 113  692 public final AuthorList getAuthorList() {
 114  692 return authorList;
 115    }
 116   
 117    /**
 118    * Set list of imports needed for this module.
 119    *
 120    * @param imports Module import list.
 121    */
 122  64 public final void setImportList(final ImportListVo imports) {
 123  64 this.importList = imports;
 124    }
 125   
 126  678 public final ImportList getImportList() {
 127  678 return importList;
 128    }
 129   
 130    /**
 131    * Set list of known modules that need this module.
 132    *
 133    * @param usedby List of modules.
 134    */
 135  58 public final void setUsedByList(final UsedByListVo usedby) {
 136  58 this.usedByList = usedby;
 137    }
 138   
 139  613 public final UsedByList getUsedByList() {
 140  613 return usedByList;
 141    }
 142   
 143    /**
 144    * Set email address of module administrator.
 145    *
 146    * @param email Email address.
 147    */
 148  80 public final void setEmail(final String email) {
 149  80 this.email = email;
 150    }
 151   
 152  706 public final String getEmail() {
 153  706 return email;
 154    }
 155   
 156  169 public boolean equals(final Object obj) {
 157  169 if (!(obj instanceof HeaderVo)) {
 158  15 return false;
 159    }
 160  154 final HeaderVo other = (HeaderVo) obj;
 161  154 return EqualsUtility.equals(getSpecification(), other.getSpecification())
 162    && EqualsUtility.equals(getTitle(), other.getTitle())
 163    && EqualsUtility.equals(getSummary(), other.getSummary())
 164    && EqualsUtility.equals(getAuthorList(), other.getAuthorList())
 165    && EqualsUtility.equals(getImportList(), other.getImportList())
 166    && EqualsUtility.equals(getUsedByList(), other.getUsedByList())
 167    && EqualsUtility.equals(getEmail(), other.getEmail());
 168    }
 169   
 170  143 public int hashCode() {
 171  143 return (getSpecification() != null ? getSpecification().hashCode() : 0)
 172  143 ^ (getTitle() != null ? 1 ^ getTitle().hashCode() : 0)
 173  143 ^ (getSummary() != null ? 2 ^ getSummary().hashCode() : 0)
 174  143 ^ (getAuthorList() != null ? 3 ^ getAuthorList().hashCode() : 0)
 175  143 ^ (getImportList() != null ? 4 ^ getImportList().hashCode() : 0)
 176  143 ^ (getUsedByList() != null ? 5 ^ getUsedByList().hashCode() : 0)
 177  143 ^ (getEmail() != null ? 6 ^ getEmail().hashCode() : 0);
 178    }
 179   
 180  87 public String toString() {
 181  87 final StringBuffer buffer = new StringBuffer("Header\n");
 182  87 buffer.append(getSpecification() + "\n");
 183  87 buffer.append("Title: ");
 184  87 buffer.append(getTitle() + "\n\n");
 185  87 buffer.append("Abstract: ");
 186  87 buffer.append(getSummary() + "\n\n");
 187  87 buffer.append(getAuthorList() + "\n");
 188  87 buffer.append(getImportList() + "\n");
 189  87 buffer.append(getUsedByList() + "\n");
 190  87 if (getEmail() != null) {
 191  61 buffer.append("\nModule email: <" + getEmail() + ">");
 192    }
 193  87 return buffer.toString();
 194    }
 195   
 196    }