Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Okt 21 2006 08:24:31 CEST
file stats: LOC: 127   Methods: 11
NCLOC: 59   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
QedeqVo.java 100% 100% 100% 100%
coverage
 1    /* $Id: QedeqVo.java,v 1.5 2006/10/20 20:23:01 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.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.LiteratureItemList;
 24    import org.qedeq.kernel.base.module.Qedeq;
 25    import org.qedeq.kernel.utility.EqualsUtility;
 26   
 27   
 28    /**
 29    * A complete qedeq module. This is the root value object.
 30    *
 31    * @version $Revision: 1.5 $
 32    * @author Michael Meyling
 33    */
 34    public final class QedeqVo implements Qedeq {
 35   
 36    /** Header of module. */
 37    private Header header;
 38   
 39    /** All module chapters. */
 40    private ChapterListVo chapterList;
 41   
 42    /** Bibliography. */
 43    private LiteratureItemList literatureItemList;
 44   
 45    /**
 46    * Constructs a new empty qedeq module.
 47    */
 48  60 public QedeqVo() {
 49    // nothing to do
 50    }
 51   
 52    /**
 53    * Set header for this module.
 54    *
 55    * @param header Module header.
 56    */
 57  40 public final void setHeader(final Header header) {
 58  40 this.header = header;
 59    }
 60   
 61  388 public final Header getHeader() {
 62  388 return header;
 63    }
 64   
 65    /**
 66    * Set chapter list of this module.
 67    *
 68    * @param chapters Chapter list.
 69    */
 70  16 public final void setChapterList(final ChapterListVo chapters) {
 71  16 this.chapterList = chapters;
 72    }
 73   
 74  2368 public final ChapterList getChapterList() {
 75  2368 return chapterList;
 76    }
 77   
 78    /**
 79    * Add chapter to this module.
 80    *
 81    * @param chapter Chapter to add.
 82    */
 83  88 public final void addChapter(final Chapter chapter) {
 84  88 if (chapterList == null) {
 85  28 chapterList = new ChapterListVo();
 86    }
 87  88 chapterList.add(chapter);
 88    }
 89   
 90  242 public LiteratureItemList getLiteratureItemList() {
 91  242 return literatureItemList;
 92    }
 93   
 94    /**
 95    * Set bibliography.
 96    *
 97    * @param literatureItemList Bibliography.
 98    */
 99  22 public void setLiteratureItemList(final LiteratureItemList literatureItemList) {
 100  22 this.literatureItemList = literatureItemList;
 101    }
 102   
 103  59 public boolean equals(final Object obj) {
 104  59 if (!(obj instanceof QedeqVo)) {
 105  6 return false;
 106    }
 107  53 final QedeqVo other = (QedeqVo) obj;
 108  53 return EqualsUtility.equals(getHeader(), other.getHeader())
 109    && EqualsUtility.equals(getChapterList(), other.getChapterList())
 110    && EqualsUtility.equals(getLiteratureItemList(), other.getLiteratureItemList());
 111    }
 112   
 113  50 public int hashCode() {
 114  50 return (getHeader() != null ? getHeader().hashCode() : 0)
 115  50 ^ (getChapterList() != null ? 1 ^ getChapterList().hashCode() : 0)
 116  50 ^ (getLiteratureItemList() != null ? 2 ^ getLiteratureItemList().hashCode() : 0);
 117    }
 118   
 119  34 public String toString() {
 120  34 final StringBuffer buffer = new StringBuffer();
 121  34 buffer.append(getHeader() + "\n\n");
 122  34 buffer.append(getChapterList() + "\n\n");
 123  34 buffer.append(getLiteratureItemList());
 124  34 return buffer.toString();
 125    }
 126   
 127    }