Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 197   Methods: 18
NCLOC: 98   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
HeaderBo.java 100% 100% 100% 100%
coverage
 1    /* $Id: HeaderBo.java,v 1.4 2006/10/20 20:23:00 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.bo.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 HeaderBo 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  76 public HeaderBo() {
 63    // nothing to do
 64    }
 65   
 66    /**
 67    * Set module specification.
 68    *
 69    * @param specification Module specification.
 70    */
 71  38 public final void setSpecification(final Specification specification) {
 72  38 this.specification = specification;
 73    }
 74   
 75  498 public final Specification getSpecification() {
 76  498 return specification;
 77    }
 78   
 79    /**
 80    * Set module title.
 81    *
 82    * @param title Module title.
 83    */
 84  38 public final void setTitle(final LatexList title) {
 85  38 this.title = title;
 86    }
 87   
 88  496 public final LatexList getTitle() {
 89  496 return title;
 90    }
 91   
 92    /**
 93    * Set module summary.
 94    *
 95    * @param summary Module summary.
 96    */
 97  38 public final void setSummary(final LatexList summary) {
 98  38 this.summary = summary;
 99    }
 100   
 101  456 public final LatexList getSummary() {
 102  456 return summary;
 103    }
 104   
 105    /**
 106    * Set list of authors of this module.
 107    *
 108    * @param authors Author list.
 109    */
 110  38 public final void setAuthorList(final AuthorList authors) {
 111  38 this.authorList = authors;
 112    }
 113   
 114  448 public final AuthorList getAuthorList() {
 115  448 return authorList;
 116    }
 117   
 118    /**
 119    * Set list of imported other modules.
 120    *
 121    * @param imports Imported other modules.
 122    */
 123  32 public final void setImportList(final ImportList imports) {
 124  32 this.importList = imports;
 125    }
 126   
 127  424 public final ImportList getImportList() {
 128  424 return importList;
 129    }
 130   
 131    /**
 132    * Set list of known modules, that depend on this one.
 133    *
 134    * @param usedby Used by which modules list.
 135    */
 136  29 public final void setUsedByList(final UsedByList usedby) {
 137  29 this.usedByList = usedby;
 138    }
 139   
 140  408 public final UsedByList getUsedByList() {
 141  408 return usedByList;
 142    }
 143   
 144    /**
 145    * Set email address of module administrator.
 146    *
 147    * @param email Email address of module administrator.
 148    */
 149  24 public final void setEmail(final String email) {
 150  24 this.email = email;
 151    }
 152   
 153  503 public final String getEmail() {
 154  503 return email;
 155    }
 156   
 157  131 public boolean equals(final Object obj) {
 158  131 if (!(obj instanceof HeaderBo)) {
 159  12 return false;
 160    }
 161  119 final HeaderBo other = (HeaderBo) obj;
 162  119 return EqualsUtility.equals(getSpecification(), other.getSpecification())
 163    && EqualsUtility.equals(getTitle(), other.getTitle())
 164    && EqualsUtility.equals(getSummary(), other.getSummary())
 165    && EqualsUtility.equals(getAuthorList(), other.getAuthorList())
 166    && EqualsUtility.equals(getImportList(), other.getImportList())
 167    && EqualsUtility.equals(getUsedByList(), other.getUsedByList())
 168    && EqualsUtility.equals(getEmail(), other.getEmail());
 169    }
 170   
 171  111 public int hashCode() {
 172  111 return (getSpecification() != null ? getSpecification().hashCode() : 0)
 173  111 ^ (getTitle() != null ? 1 ^ getTitle().hashCode() : 0)
 174  111 ^ (getSummary() != null ? 2 ^ getSummary().hashCode() : 0)
 175  111 ^ (getAuthorList() != null ? 3 ^ getAuthorList().hashCode() : 0)
 176  111 ^ (getImportList() != null ? 4 ^ getImportList().hashCode() : 0)
 177  111 ^ (getUsedByList() != null ? 5 ^ getUsedByList().hashCode() : 0)
 178  111 ^ (getEmail() != null ? 6 ^ getEmail().hashCode() : 0);
 179    }
 180   
 181  71 public String toString() {
 182  71 final StringBuffer buffer = new StringBuffer("Header\n");
 183  71 buffer.append(getSpecification() + "\n");
 184  71 buffer.append("Title: ");
 185  71 buffer.append(getTitle() + "\n\n");
 186  71 buffer.append("Abstract: ");
 187  71 buffer.append(getSummary() + "\n\n");
 188  71 buffer.append(getAuthorList() + "\n");
 189  71 buffer.append(getImportList() + "\n");
 190  71 buffer.append(getUsedByList() + "\n");
 191  71 if (getEmail() != null) {
 192  45 buffer.append("\nModule email: <" + getEmail() + ">");
 193    }
 194  71 return buffer.toString();
 195    }
 196   
 197    }