Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 126   Methods: 11
NCLOC: 58   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.ChapterList;
 21    import org.qedeq.kernel.base.module.Header;
 22    import org.qedeq.kernel.base.module.LiteratureItemList;
 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.5 $
 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    /** Bibliography. */
 42    private LiteratureItemList literatureItemList;
 43   
 44    /**
 45    * Constructs a new empty qedeq module.
 46    */
 47  62 public QedeqVo() {
 48    // nothing to do
 49    }
 50   
 51    /**
 52    * Set header for this module.
 53    *
 54    * @param header Module header.
 55    */
 56  42 public final void setHeader(final HeaderVo header) {
 57  42 this.header = header;
 58    }
 59   
 60  478 public final Header getHeader() {
 61  478 return header;
 62    }
 63   
 64    /**
 65    * Set chapter list of this module.
 66    *
 67    * @param chapters Chapter list.
 68    */
 69  16 public final void setChapterList(final ChapterListVo chapters) {
 70  16 this.chapterList = chapters;
 71    }
 72   
 73  3110 public final ChapterList getChapterList() {
 74  3110 return chapterList;
 75    }
 76   
 77    /**
 78    * Add chapter to this module.
 79    *
 80    * @param chapter Chapter to add.
 81    */
 82  92 public final void addChapter(final ChapterVo chapter) {
 83  92 if (chapterList == null) {
 84  30 chapterList = new ChapterListVo();
 85    }
 86  92 chapterList.add(chapter);
 87    }
 88   
 89  264 public LiteratureItemList getLiteratureItemList() {
 90  264 return literatureItemList;
 91    }
 92   
 93    /**
 94    * Set bibliography.
 95    *
 96    * @param literatureItemList Bibliography.
 97    */
 98  22 public void setLiteratureItemList(final LiteratureItemListVo literatureItemList) {
 99  22 this.literatureItemList = literatureItemList;
 100    }
 101   
 102  59 public boolean equals(final Object obj) {
 103  59 if (!(obj instanceof QedeqVo)) {
 104  6 return false;
 105    }
 106  53 final QedeqVo other = (QedeqVo) obj;
 107  53 return EqualsUtility.equals(getHeader(), other.getHeader())
 108    && EqualsUtility.equals(getChapterList(), other.getChapterList())
 109    && EqualsUtility.equals(getLiteratureItemList(), other.getLiteratureItemList());
 110    }
 111   
 112  50 public int hashCode() {
 113  50 return (getHeader() != null ? getHeader().hashCode() : 0)
 114  50 ^ (getChapterList() != null ? 1 ^ getChapterList().hashCode() : 0)
 115  50 ^ (getLiteratureItemList() != null ? 2 ^ getLiteratureItemList().hashCode() : 0);
 116    }
 117   
 118  34 public String toString() {
 119  34 final StringBuffer buffer = new StringBuffer();
 120  34 buffer.append(getHeader() + "\n\n");
 121  34 buffer.append(getChapterList() + "\n\n");
 122  34 buffer.append(getLiteratureItemList());
 123  34 return buffer.toString();
 124    }
 125   
 126    }