Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
19   123   16   1.73
10   58   0.84   11
11     1.45  
1    
 
  QedeqVo       Line # 30 19 16 100% 1.0
 
  (114)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.se.dto.module;
17   
18    import org.qedeq.base.utility.EqualsUtility;
19    import org.qedeq.kernel.se.base.module.ChapterList;
20    import org.qedeq.kernel.se.base.module.Header;
21    import org.qedeq.kernel.se.base.module.LiteratureItemList;
22    import org.qedeq.kernel.se.base.module.Qedeq;
23   
24   
25    /**
26    * A complete QEDEQ module. This is the root value object.
27    *
28    * @author Michael Meyling
29    */
 
30    public class QedeqVo implements Qedeq {
31   
32    /** Header of module. */
33    private Header header;
34   
35    /** All module chapters. */
36    private ChapterListVo chapterList;
37   
38    /** Bibliography. */
39    private LiteratureItemList literatureItemList;
40   
41    /**
42    * Constructs a new empty qedeq module.
43    */
 
44  1371 toggle public QedeqVo() {
45    // nothing to do
46    }
47   
48    /**
49    * Set header for this module.
50    *
51    * @param header Module header.
52    */
 
53  1214 toggle public final void setHeader(final HeaderVo header) {
54  1214 this.header = header;
55    }
56   
 
57  305697 toggle public final Header getHeader() {
58  305697 return header;
59    }
60   
61    /**
62    * Set chapter list of this module.
63    *
64    * @param chapters Chapter list.
65    */
 
66  725 toggle public final void setChapterList(final ChapterListVo chapters) {
67  725 this.chapterList = chapters;
68    }
69   
 
70  1096063 toggle public final ChapterList getChapterList() {
71  1096063 return chapterList;
72    }
73   
74    /**
75    * Add chapter to this module.
76    *
77    * @param chapter Chapter to add.
78    */
 
79  2344 toggle public final void addChapter(final ChapterVo chapter) {
80  2344 if (chapterList == null) {
81  597 chapterList = new ChapterListVo();
82    }
83  2344 chapterList.add(chapter);
84    }
85   
 
86  4344 toggle public LiteratureItemList getLiteratureItemList() {
87  4344 return literatureItemList;
88    }
89   
90    /**
91    * Set bibliography.
92    *
93    * @param literatureItemList Bibliography.
94    */
 
95  525 toggle public void setLiteratureItemList(final LiteratureItemListVo literatureItemList) {
96  525 this.literatureItemList = literatureItemList;
97    }
98   
 
99  59 toggle public boolean equals(final Object obj) {
100  59 if (!(obj instanceof QedeqVo)) {
101  6 return false;
102    }
103  53 final QedeqVo other = (QedeqVo) obj;
104  53 return EqualsUtility.equals(getHeader(), other.getHeader())
105    && EqualsUtility.equals(getChapterList(), other.getChapterList())
106    && EqualsUtility.equals(getLiteratureItemList(), other.getLiteratureItemList());
107    }
108   
 
109  50 toggle public int hashCode() {
110  50 return (getHeader() != null ? getHeader().hashCode() : 0)
111  50 ^ (getChapterList() != null ? 1 ^ getChapterList().hashCode() : 0)
112  50 ^ (getLiteratureItemList() != null ? 2 ^ getLiteratureItemList().hashCode() : 0);
113    }
114   
 
115  34 toggle public String toString() {
116  34 final StringBuffer buffer = new StringBuffer();
117  34 buffer.append(getHeader() + "\n\n");
118  34 buffer.append(getChapterList() + "\n\n");
119  34 buffer.append(getLiteratureItemList());
120  34 return buffer.toString();
121    }
122   
123    }