Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 170   Methods: 14
NCLOC: 79   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DefaultQedeqBo.java 100% 100% 100% 100%
coverage
 1    /* $Id: DefaultQedeqBo.java,v 1.1 2007/05/10 00:37:51 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.bo.load;
 19   
 20    import org.qedeq.kernel.base.module.ChapterList;
 21    import org.qedeq.kernel.base.module.Header;
 22    import org.qedeq.kernel.base.module.LiteratureItemList;
 23    import org.qedeq.kernel.bo.module.ModuleAddress;
 24    import org.qedeq.kernel.bo.module.ModuleLabels;
 25    import org.qedeq.kernel.bo.module.QedeqBo;
 26    import org.qedeq.kernel.dto.module.ChapterListVo;
 27    import org.qedeq.kernel.dto.module.ChapterVo;
 28    import org.qedeq.kernel.dto.module.HeaderVo;
 29    import org.qedeq.kernel.dto.module.LiteratureItemListVo;
 30    import org.qedeq.kernel.utility.EqualsUtility;
 31   
 32   
 33    /**
 34    * A complete QEDEQ module. This is the root business object.
 35    *
 36    * TODO mime 20070131: shouldn't be a globalContext also an attribute of this class?
 37    *
 38    * @version $Revision: 1.1 $
 39    * @author Michael Meyling
 40    */
 41    public class DefaultQedeqBo implements QedeqBo {
 42   
 43    /** Header of module. */
 44    private HeaderVo header;
 45   
 46    /** All module chapters. */
 47    private ChapterListVo chapterList;
 48   
 49    /** All module labels and their business objects. */
 50    private final ModuleLabels moduleLabels;
 51   
 52    /** Bibliography. */
 53    private LiteratureItemList literatureItemList;
 54   
 55    /** Module address information. */
 56    private ModuleAddress moduleAddress;
 57   
 58    /**
 59    * Constructs a new empty QEDEQ module.
 60    */
 61  65 public DefaultQedeqBo() {
 62  65 moduleLabels = new ModuleLabels();
 63    }
 64   
 65    /**
 66    * Set header of module.
 67    *
 68    * @param header Module header.
 69    */
 70  37 public final void setHeader(final HeaderVo header) {
 71  37 this.header = header;
 72    }
 73   
 74  366 public final Header getHeader() {
 75  366 return header;
 76    }
 77   
 78    /**
 79    * Set chapter list of this module.
 80    *
 81    * @param chapters Chapter list.
 82    */
 83  35 public final void setChapterList(final ChapterListVo chapters) {
 84  35 this.chapterList = chapters;
 85    }
 86   
 87  336 public final ChapterList getChapterList() {
 88  336 return chapterList;
 89    }
 90   
 91    /**
 92    * Add chapter to this module.
 93    *
 94    * @param chapter Chapter to add.
 95    */
 96  7 public final void addChapter(final ChapterVo chapter) {
 97  7 if (chapterList == null) {
 98  4 chapterList = new ChapterListVo();
 99    }
 100  7 chapterList.add(chapter);
 101    }
 102   
 103    /**
 104    * Set bibliography.
 105    *
 106    * @param literatureItemList Bibliography.
 107    */
 108  18 public void setLiteratureItemList(final LiteratureItemListVo literatureItemList) {
 109  18 this.literatureItemList = literatureItemList;
 110    }
 111   
 112  262 public LiteratureItemList getLiteratureItemList() {
 113  262 return literatureItemList;
 114    }
 115   
 116    /**
 117    * Get module label associations for this module.
 118    *
 119    * @return Label associations.
 120    */
 121  622 public final ModuleLabels getModuleLabels() {
 122  622 return moduleLabels;
 123    }
 124   
 125    /**
 126    * Get physical addresses of this module.
 127    *
 128    * @return Module address..
 129    */
 130  167 public final ModuleAddress getModuleAddress() {
 131  167 return moduleAddress;
 132    }
 133   
 134    /**
 135    * Get physical addresses of this module.
 136    *
 137    * @param address Module address.
 138    */
 139  18 public final void setModuleAddress(final ModuleAddress address) {
 140  18 this.moduleAddress = address;
 141    }
 142   
 143  71 public boolean equals(final Object obj) {
 144  71 if (!(obj instanceof DefaultQedeqBo)) {
 145  7 return false;
 146    }
 147  64 final DefaultQedeqBo other = (DefaultQedeqBo) obj;
 148  64 return EqualsUtility.equals(getHeader(), other.getHeader())
 149    && EqualsUtility.equals(getChapterList(), other.getChapterList())
 150    && EqualsUtility.equals(getLiteratureItemList(), other.getLiteratureItemList())
 151    && EqualsUtility.equals(getModuleAddress(), other.getModuleAddress());
 152    }
 153   
 154  36 public int hashCode() {
 155  36 return (getHeader() != null ? getHeader().hashCode() : 0)
 156  36 ^ (getChapterList() != null ? 1 ^ getChapterList().hashCode() : 0)
 157  36 ^ (getLiteratureItemList() != null ? 2 ^ getLiteratureItemList().hashCode() : 0)
 158  36 ^ (getModuleAddress() != null ? 3 ^ getModuleAddress().hashCode() : 0);
 159    }
 160   
 161  39 public String toString() {
 162  39 final StringBuffer buffer = new StringBuffer();
 163  39 buffer.append(getModuleAddress() + "\n");
 164  39 buffer.append(getHeader() + "\n\n");
 165  39 buffer.append(getChapterList() + "\n\n");
 166  39 buffer.append(getLiteratureItemList());
 167  39 return buffer.toString();
 168    }
 169   
 170    }