Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
31   196   20   1,72
18   98   0,65   18
18     1,11  
1    
 
  HeaderVo       Line # 36 31 20 100% 1.0
 
  (38)
 
1    /* $Id: HeaderVo.java,v 1.9 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.AuthorList;
22    import org.qedeq.kernel.base.module.Header;
23    import org.qedeq.kernel.base.module.ImportList;
24    import org.qedeq.kernel.base.module.LatexList;
25    import org.qedeq.kernel.base.module.Specification;
26    import org.qedeq.kernel.base.module.UsedByList;
27   
28   
29    /**
30    * Header of a qedeq file. The header specifies such things as the location of the file,
31    * the title and abstract of that module, imports and exports.
32    *
33    * @version $Revision: 1.9 $
34    * @author Michael Meyling
35    */
 
36    public class HeaderVo implements Header {
37   
38    /** Module specification. */
39    private Specification specification;
40   
41    /** Module title. */
42    private LatexList title;
43   
44    /** Module "abstract". */
45    private LatexList summary;
46   
47    /** Author list. */
48    private AuthorList authorList;
49   
50    /** List of imported modules. */
51    private ImportList importList;
52   
53    /** List of modules that depend on current one. */
54    private UsedByList usedByList;
55   
56    /** Email address of module administrator. */
57    private String email;
58   
59    /**
60    * Constructs a new module header.
61    */
 
62  321 toggle public HeaderVo() {
63    // nothing to do
64    }
65   
66    /**
67    * Set module specification.
68    * @param specification Module specification.
69    */
 
70  283 toggle public final void setSpecification(final SpecificationVo specification) {
71  283 this.specification = specification;
72    }
73   
 
74  66708 toggle public final Specification getSpecification() {
75  66708 return specification;
76    }
77   
78    /**
79    * Set module title.
80    *
81    * @param title Module title texts.
82    */
 
83  283 toggle public final void setTitle(final LatexListVo title) {
84  283 this.title = title;
85    }
86   
 
87  66465 toggle public final LatexList getTitle() {
88  66465 return title;
89    }
90   
91    /**
92    * Set module summary text.
93    *
94    * @param summary Module summary text.
95    */
 
96  283 toggle public final void setSummary(final LatexListVo summary) {
97  283 this.summary = summary;
98    }
99   
 
100  66321 toggle public final LatexList getSummary() {
101  66321 return summary;
102    }
103   
104    /**
105    * Set list of authors of this module.
106    *
107    * @param authors Author list.
108    */
 
109  283 toggle public final void setAuthorList(final AuthorListVo authors) {
110  283 this.authorList = authors;
111    }
112   
 
113  66269 toggle public final AuthorList getAuthorList() {
114  66269 return authorList;
115    }
116   
117    /**
118    * Set list of imports needed for this module.
119    *
120    * @param imports Module import list.
121    */
 
122  201 toggle public final void setImportList(final ImportListVo imports) {
123  201 this.importList = imports;
124    }
125   
 
126  58124 toggle public final ImportList getImportList() {
127  58124 return importList;
128    }
129   
130    /**
131    * Set list of known modules that need this module.
132    *
133    * @param usedby List of modules.
134    */
 
135  100 toggle public final void setUsedByList(final UsedByListVo usedby) {
136  100 this.usedByList = usedby;
137    }
138   
 
139  41082 toggle public final UsedByList getUsedByList() {
140  41082 return usedByList;
141    }
142   
143    /**
144    * Set email address of module administrator.
145    *
146    * @param email Email address.
147    */
 
148  283 toggle public final void setEmail(final String email) {
149  283 this.email = email;
150    }
151   
 
152  794 toggle public final String getEmail() {
153  794 return email;
154    }
155   
 
156  131 toggle public boolean equals(final Object obj) {
157  131 if (!(obj instanceof HeaderVo)) {
158  12 return false;
159    }
160  119 final HeaderVo other = (HeaderVo) obj;
161  119 return EqualsUtility.equals(getSpecification(), other.getSpecification())
162    && EqualsUtility.equals(getTitle(), other.getTitle())
163    && EqualsUtility.equals(getSummary(), other.getSummary())
164    && EqualsUtility.equals(getAuthorList(), other.getAuthorList())
165    && EqualsUtility.equals(getImportList(), other.getImportList())
166    && EqualsUtility.equals(getUsedByList(), other.getUsedByList())
167    && EqualsUtility.equals(getEmail(), other.getEmail());
168    }
169   
 
170  122 toggle public int hashCode() {
171  122 return (getSpecification() != null ? getSpecification().hashCode() : 0)
172  122 ^ (getTitle() != null ? 1 ^ getTitle().hashCode() : 0)
173  122 ^ (getSummary() != null ? 2 ^ getSummary().hashCode() : 0)
174  122 ^ (getAuthorList() != null ? 3 ^ getAuthorList().hashCode() : 0)
175  122 ^ (getImportList() != null ? 4 ^ getImportList().hashCode() : 0)
176  122 ^ (getUsedByList() != null ? 5 ^ getUsedByList().hashCode() : 0)
177  122 ^ (getEmail() != null ? 6 ^ getEmail().hashCode() : 0);
178    }
179   
 
180  66 toggle public String toString() {
181  66 final StringBuffer buffer = new StringBuffer("Header\n");
182  66 buffer.append(getSpecification() + "\n");
183  66 buffer.append("Title: ");
184  66 buffer.append(getTitle() + "\n\n");
185  66 buffer.append("Abstract: ");
186  66 buffer.append(getSummary() + "\n\n");
187  66 buffer.append(getAuthorList() + "\n");
188  66 buffer.append(getImportList() + "\n");
189  66 buffer.append(getUsedByList() + "\n");
190  66 if (getEmail() != null) {
191  42 buffer.append("\nModule email: <" + getEmail() + ">");
192    }
193  66 return buffer.toString();
194    }
195   
196    }