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