Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
24   144   15   1.85
12   69   0.62   13
13     1.15  
1    
 
  ChapterVo       Line # 30 24 15 100% 1.0
 
  (53)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2010, 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.dto.module;
17   
18    import org.qedeq.base.utility.EqualsUtility;
19    import org.qedeq.kernel.base.module.Chapter;
20    import org.qedeq.kernel.base.module.LatexList;
21    import org.qedeq.kernel.base.module.SectionList;
22   
23   
24    /**
25    * Chapter.
26    *
27    * @version $Revision: 1.11 $
28    * @author Michael Meyling
29    */
 
30    public class ChapterVo implements Chapter {
31   
32    /** Chapter title. */
33    private LatexList title;
34   
35    /** No chapter number. */
36    private Boolean noNumber;
37   
38    /** Chapter introduction. */
39    private LatexList introduction;
40   
41    /** List of chapter sections. */
42    private SectionListVo sectionList;
43   
44    /**
45    * Constructs a new chapter.
46    */
 
47  730 toggle public ChapterVo() {
48    // nothing to do
49    }
50   
51    /**
52    * Set automatic chapter number off or on.
53    *
54    * @param noNumber No chapter numbering?
55    */
 
56  458 toggle public final void setNoNumber(final Boolean noNumber) {
57  458 this.noNumber = noNumber;
58    }
59   
 
60  1624 toggle public final Boolean getNoNumber() {
61  1624 return noNumber;
62    }
63   
64    /**
65    * Set chapter title.
66    *
67    * @param title LaTeX list of chapter titles.
68    */
 
69  705 toggle public final void setTitle(final LatexListVo title) {
70  705 this.title = title;
71    }
72   
 
73  292656 toggle public final LatexList getTitle() {
74  292656 return title;
75    }
76   
77    /**
78    * Set chapter introduction text.
79    *
80    * @param introduction Introduction text.
81    */
 
82  571 toggle public final void setIntroduction(final LatexListVo introduction) {
83  571 this.introduction = introduction;
84    }
85   
 
86  291990 toggle public final LatexList getIntroduction() {
87  291990 return introduction;
88    }
89   
90    /**
91    * Set list of sections.
92    *
93    * @param sections Section list.
94    */
 
95  219 toggle public final void setSectionList(final SectionListVo sections) {
96  219 this.sectionList = sections;
97    }
98   
 
99  252225 toggle public final SectionList getSectionList() {
100  252225 return sectionList;
101    }
102   
103    /**
104    * Add section to list.
105    *
106    * @param section Section to add.
107    */
 
108  435 toggle public final void addSection(final SectionVo section) {
109  435 if (sectionList == null) {
110  193 sectionList = new SectionListVo();
111    }
112  435 sectionList.add(section);
113    }
114   
 
115  129 toggle public boolean equals(final Object obj) {
116  129 if (!(obj instanceof ChapterVo)) {
117  9 return false;
118    }
119  120 final ChapterVo other = (ChapterVo) obj;
120  120 return EqualsUtility.equals(getNoNumber(), other.getNoNumber())
121    && EqualsUtility.equals(getTitle(), other.getTitle())
122    && EqualsUtility.equals(getIntroduction(), other.getIntroduction())
123    && EqualsUtility.equals(getSectionList(), other.getSectionList());
124    }
125   
 
126  136 toggle public int hashCode() {
127  136 return (getNoNumber() != null ? getNoNumber().hashCode() : 0)
128  136 ^ (getTitle() != null ? getTitle().hashCode() : 0)
129  136 ^ (getIntroduction() != null ? 1 ^ getIntroduction().hashCode() : 0)
130  136 ^ (getSectionList() != null ? 2 ^ getSectionList().hashCode() : 0);
131    }
132   
 
133  105 toggle public String toString() {
134  105 final StringBuffer buffer = new StringBuffer();
135  105 buffer.append("Chapter noNumber: " + getNoNumber() + "\n");
136  105 buffer.append("Chapter Title:\n");
137  105 buffer.append(getTitle() + "\n\n");
138  105 buffer.append("Introduction:\n");
139  105 buffer.append(getIntroduction() + "\n\n");
140  105 buffer.append(getSectionList() + "\n");
141  105 return buffer.toString();
142    }
143   
144    }