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