Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 107   Methods: 9
NCLOC: 48   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
QedeqVo.java 100% 100% 100% 100%
coverage
 1    /* $Id: QedeqVo.java,v 1.4 2005/06/15 16:11:46 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.dto.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.utility.EqualsUtility;
 25   
 26   
 27    /**
 28    * A complete qedeq module. This is the root value object.
 29    *
 30    * @version $Revision: 1.4 $
 31    * @author Michael Meyling
 32    */
 33    public final class QedeqVo implements Qedeq {
 34   
 35    /** Header of module. */
 36    private Header header;
 37   
 38    /** All module chapters. */
 39    private ChapterListVo chapterList;
 40   
 41    /**
 42    * Constructs a new empty qedeq module.
 43    */
 44  47 public QedeqVo() {
 45    // nothing to do
 46    }
 47   
 48    /**
 49    * Set header for this module.
 50    *
 51    * @param header Module header.
 52    */
 53  32 public final void setHeader(final Header header) {
 54  32 this.header = header;
 55    }
 56   
 57  287 public final Header getHeader() {
 58  287 return header;
 59    }
 60   
 61    /**
 62    * Set chapter list of this module.
 63    *
 64    * @param chapters Chapter list.
 65    */
 66  16 public final void setChapterList(final ChapterListVo chapters) {
 67  16 this.chapterList = chapters;
 68    }
 69   
 70  493 public final ChapterList getChapterList() {
 71  493 return chapterList;
 72    }
 73   
 74    /**
 75    * Add chapter to this module.
 76    *
 77    * @param chapter Chapter to add.
 78    */
 79  45 public final void addChapter(final Chapter chapter) {
 80  45 if (chapterList == null) {
 81  20 chapterList = new ChapterListVo();
 82    }
 83  45 chapterList.add(chapter);
 84    }
 85   
 86  47 public boolean equals(final Object obj) {
 87  47 if (!(obj instanceof QedeqVo)) {
 88  5 return false;
 89    }
 90  42 final QedeqVo other = (QedeqVo) obj;
 91  42 return EqualsUtility.equals(getHeader(), other.getHeader())
 92    && EqualsUtility.equals(getChapterList(), other.getChapterList());
 93    }
 94   
 95  38 public int hashCode() {
 96  38 return (getHeader() != null ? getHeader().hashCode() : 0)
 97  38 ^ (getChapterList() != null ? 1 ^ getChapterList().hashCode() : 0);
 98    }
 99   
 100  28 public String toString() {
 101  28 final StringBuffer buffer = new StringBuffer();
 102  28 buffer.append(getHeader() + "\n\n");
 103  28 buffer.append(getChapterList());
 104  28 return buffer.toString();
 105    }
 106   
 107    }