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