Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
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.6 2006/10/20 20:23:01 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.6 $
 30    * @author Michael Meyling
 31    */
 32    public final 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  242 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  167 public final void setNoNumber(final Boolean noNumber) {
 59  167 this.noNumber = noNumber;
 60    }
 61   
 62  858 public final Boolean getNoNumber() {
 63  858 return noNumber;
 64    }
 65   
 66    /**
 67    * Set chapter title.
 68    *
 69    * @param title LaTeX list of chapter titles.
 70    */
 71  217 public final void setTitle(final LatexListVo title) {
 72  217 this.title = title;
 73    }
 74   
 75  1055 public final LatexList getTitle() {
 76  1055 return title;
 77    }
 78   
 79    /**
 80    * Set chapter introduction text.
 81    *
 82    * @param introduction Introduction text.
 83    */
 84  217 public final void setIntroduction(final LatexListVo introduction) {
 85  217 this.introduction = introduction;
 86    }
 87   
 88  1016 public final LatexList getIntroduction() {
 89  1016 return introduction;
 90    }
 91   
 92    /**
 93    * Set list of sections.
 94    *
 95    * @param sections Section list.
 96    */
 97  98 public final void setSectionList(final SectionListVo sections) {
 98  98 this.sectionList = sections;
 99    }
 100   
 101  3461 public final SectionList getSectionList() {
 102  3461 return sectionList;
 103    }
 104   
 105    /**
 106    * Add section to list.
 107    *
 108    * @param section Section to add.
 109    */
 110  142 public final void addSection(final SectionVo section) {
 111  142 if (sectionList == null) {
 112  55 sectionList = new SectionListVo();
 113    }
 114  142 sectionList.add(section);
 115    }
 116   
 117  151 public boolean equals(final Object obj) {
 118  151 if (!(obj instanceof ChapterVo)) {
 119  10 return false;
 120    }
 121  141 final ChapterVo other = (ChapterVo) obj;
 122  141 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  128 public int hashCode() {
 129  128 return (getNoNumber() != null ? getNoNumber().hashCode() : 0)
 130  128 ^ (getTitle() != null ? getTitle().hashCode() : 0)
 131  128 ^ (getIntroduction() != null ? 1 ^ getIntroduction().hashCode() : 0)
 132  128 ^ (getSectionList() != null ? 2 ^ getSectionList().hashCode() : 0);
 133    }
 134   
 135  103 public String toString() {
 136  103 final StringBuffer buffer = new StringBuffer();
 137  103 buffer.append("Chapter noNumber: " + getNoNumber() + "\n");
 138  103 buffer.append("Chapter Title:\n");
 139  103 buffer.append(getTitle() + "\n\n");
 140  103 buffer.append("Introduction:\n");
 141  103 buffer.append(getIntroduction() + "\n\n");
 142  103 buffer.append(getSectionList() + "\n");
 143  103 return buffer.toString();
 144    }
 145   
 146    }