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