Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
file stats: LOC: 146   Methods: 13
NCLOC: 69   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ChapterVo.java 100% 100% 100% 100%
coverage
 1    /* $Id: ChapterVo.java,v 1.9 2007/05/10 00:37:50 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, 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.Chapter;
 21    import org.qedeq.kernel.base.module.LatexList;
 22    import org.qedeq.kernel.base.module.SectionList;
 23    import org.qedeq.kernel.utility.EqualsUtility;
 24   
 25   
 26    /**
 27    * Chapter.
 28    *
 29    * @version $Revision: 1.9 $
 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  344 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  236 public final void setNoNumber(final Boolean noNumber) {
 59  236 this.noNumber = noNumber;
 60    }
 61   
 62  994 public final Boolean getNoNumber() {
 63  994 return noNumber;
 64    }
 65   
 66    /**
 67    * Set chapter title.
 68    *
 69    * @param title LaTeX list of chapter titles.
 70    */
 71  319 public final void setTitle(final LatexListVo title) {
 72  319 this.title = title;
 73    }
 74   
 75  240776 public final LatexList getTitle() {
 76  240776 return title;
 77    }
 78   
 79    /**
 80    * Set chapter introduction text.
 81    *
 82    * @param introduction Introduction text.
 83    */
 84  313 public final void setIntroduction(final LatexListVo introduction) {
 85  313 this.introduction = introduction;
 86    }
 87   
 88  240234 public final LatexList getIntroduction() {
 89  240234 return introduction;
 90    }
 91   
 92    /**
 93    * Set list of sections.
 94    *
 95    * @param sections Section list.
 96    */
 97  130 public final void setSectionList(final SectionListVo sections) {
 98  130 this.sectionList = sections;
 99    }
 100   
 101  208583 public final SectionList getSectionList() {
 102  208583 return sectionList;
 103    }
 104   
 105    /**
 106    * Add section to list.
 107    *
 108    * @param section Section to add.
 109    */
 110  265 public final void addSection(final SectionVo section) {
 111  265 if (sectionList == null) {
 112  94 sectionList = new SectionListVo();
 113    }
 114  265 sectionList.add(section);
 115    }
 116   
 117  158 public boolean equals(final Object obj) {
 118  158 if (!(obj instanceof ChapterVo)) {
 119  10 return false;
 120    }
 121  148 final ChapterVo other = (ChapterVo) obj;
 122  148 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  130 public int hashCode() {
 129  130 return (getNoNumber() != null ? getNoNumber().hashCode() : 0)
 130  130 ^ (getTitle() != null ? getTitle().hashCode() : 0)
 131  130 ^ (getIntroduction() != null ? 1 ^ getIntroduction().hashCode() : 0)
 132  130 ^ (getSectionList() != null ? 2 ^ getSectionList().hashCode() : 0);
 133    }
 134   
 135  105 public String toString() {
 136  105 final StringBuffer buffer = new StringBuffer();
 137  105 buffer.append("Chapter noNumber: " + getNoNumber() + "\n");
 138  105 buffer.append("Chapter Title:\n");
 139  105 buffer.append(getTitle() + "\n\n");
 140  105 buffer.append("Introduction:\n");
 141  105 buffer.append(getIntroduction() + "\n\n");
 142  105 buffer.append(getSectionList() + "\n");
 143  105 return buffer.toString();
 144    }
 145   
 146    }