HeaderVo.java
001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002  *
003  * Copyright 2000-2011,  Michael Meyling <mime@qedeq.org>.
004  *
005  * "Hilbert II" is free software; you can redistribute
006  * it and/or modify it under the terms of the GNU General Public
007  * License as published by the Free Software Foundation; either
008  * version 2 of the License, or (at your option) any later version.
009  *
010  * This program is distributed in the hope that it will be useful,
011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013  * GNU General Public License for more details.
014  */
015 
016 package org.qedeq.kernel.se.dto.module;
017 
018 import org.qedeq.base.utility.EqualsUtility;
019 import org.qedeq.kernel.se.base.module.AuthorList;
020 import org.qedeq.kernel.se.base.module.Header;
021 import org.qedeq.kernel.se.base.module.ImportList;
022 import org.qedeq.kernel.se.base.module.LatexList;
023 import org.qedeq.kernel.se.base.module.Specification;
024 import org.qedeq.kernel.se.base.module.UsedByList;
025 
026 
027 /**
028  * Header of a qedeq file. The header specifies such things as the location of the file,
029  * the title and abstract of that module, imports and exports.
030  *
031  @author  Michael Meyling
032  */
033 public class HeaderVo implements Header {
034 
035     /** Module specification. */
036     private Specification specification;
037 
038     /** Module title. */
039     private LatexList title;
040 
041     /** Module "abstract". */
042     private LatexList summary;
043 
044     /** Author list. */
045     private AuthorList authorList;
046 
047     /** List of imported modules. */
048     private ImportList importList;
049 
050     /** List of modules that depend on current one. */
051     private UsedByList usedByList;
052 
053     /** Email address of module administrator. */
054     private String email;
055 
056     /**
057      * Constructs a new module header.
058      */
059     public HeaderVo() {
060         // nothing to do
061     }
062 
063     /**
064      * Set module specification.
065      @param   specification  Module specification.
066      */
067     public final void setSpecification(final SpecificationVo specification) {
068         this.specification = specification;
069     }
070 
071     public final Specification getSpecification() {
072         return specification;
073     }
074 
075     /**
076      * Set module title.
077      *
078      @param   title   Module title texts.
079      */
080     public final void setTitle(final LatexListVo title) {
081         this.title = title;
082     }
083 
084     public final LatexList getTitle() {
085         return title;
086     }
087 
088     /**
089      * Set module summary text.
090      *
091      @param   summary Module summary text.
092      */
093     public final void setSummary(final LatexListVo summary) {
094         this.summary = summary;
095     }
096 
097     public final LatexList getSummary() {
098         return summary;
099     }
100 
101     /**
102      * Set list of authors of this module.
103      *
104      @param   authors Author list.
105      */
106     public final void setAuthorList(final AuthorListVo authors) {
107         this.authorList = authors;
108     }
109 
110     public final AuthorList getAuthorList() {
111         return authorList;
112     }
113 
114     /**
115      * Set list of imports needed for this module.
116      *
117      @param   imports Module import list.
118      */
119     public final void setImportList(final ImportListVo imports) {
120         this.importList = imports;
121     }
122 
123     public final ImportList getImportList() {
124         return importList;
125     }
126 
127     /**
128      * Set list of known modules that need this module.
129      *
130      @param   usedby  List of modules.
131      */
132     public final void setUsedByList(final UsedByListVo usedby) {
133         this.usedByList = usedby;
134     }
135 
136     public final UsedByList getUsedByList() {
137         return usedByList;
138     }
139 
140     /**
141      * Set email address of module administrator.
142      *
143      @param   email   Email address.
144      */
145     public final void setEmail(final String email) {
146         this.email = email;
147     }
148 
149     public final String getEmail() {
150         return email;
151     }
152 
153     public boolean equals(final Object obj) {
154         if (!(obj instanceof HeaderVo)) {
155             return false;
156         }
157         final HeaderVo other = (HeaderVoobj;
158         return  EqualsUtility.equals(getSpecification(), other.getSpecification())
159             && EqualsUtility.equals(getTitle(), other.getTitle())
160             && EqualsUtility.equals(getSummary(), other.getSummary())
161             && EqualsUtility.equals(getAuthorList(), other.getAuthorList())
162             && EqualsUtility.equals(getImportList(), other.getImportList())
163             && EqualsUtility.equals(getUsedByList(), other.getUsedByList())
164             && EqualsUtility.equals(getEmail(), other.getEmail());
165     }
166 
167     public int hashCode() {
168         return (getSpecification() != null ? getSpecification().hashCode() 0)
169             (getTitle() != null ^ getTitle().hashCode() 0)
170             (getSummary() != null ^ getSummary().hashCode() 0)
171             (getAuthorList() != null ^ getAuthorList().hashCode() 0)
172             (getImportList() != null ^ getImportList().hashCode() 0)
173             (getUsedByList() != null ^ getUsedByList().hashCode() 0)
174             (getEmail() != null ^ getEmail().hashCode() 0);
175     }
176 
177     public String toString() {
178         final StringBuffer buffer = new StringBuffer("Header\n");
179         buffer.append(getSpecification() "\n");
180         buffer.append("Title: ");
181         buffer.append(getTitle() "\n\n");
182         buffer.append("Abstract: ");
183         buffer.append(getSummary() "\n\n");
184         buffer.append(getAuthorList() "\n");
185         buffer.append(getImportList() "\n");
186         buffer.append(getUsedByList() "\n");
187         if (getEmail() != null) {
188             buffer.append("\nModule email: <" + getEmail() ">");
189         }
190         return buffer.toString();
191     }
192 
193 }