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