LiteratureItemVo.java
01 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
02  *
03  * Copyright 2000-2013,  Michael Meyling <mime@qedeq.org>.
04  *
05  * "Hilbert II" is free software; you can redistribute
06  * it and/or modify it under the terms of the GNU General Public
07  * License as published by the Free Software Foundation; either
08  * version 2 of the License, or (at your option) any later version.
09  *
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.se.dto.module;
17 
18 import org.qedeq.base.utility.EqualsUtility;
19 import org.qedeq.kernel.se.base.module.LatexList;
20 import org.qedeq.kernel.se.base.module.LiteratureItem;
21 
22 
23 /**
24  * Single literature reference.
25  *
26  @author  Michael Meyling
27  */
28 public class LiteratureItemVo implements LiteratureItem {
29 
30     /** Reference to this object with this label. */
31     private String label;
32 
33     /** Reference description. */
34     private LatexList item;
35 
36     /**
37      * Constructs a new section.
38      */
39     public LiteratureItemVo() {
40         // nothing to do
41     }
42 
43     /**
44      * Set reference label for this literature reference.
45      *
46      @param   label   Reference to this object with this label.
47      */
48     public final void setLabel(final String label) {
49         this.label = label;
50     }
51 
52     public final String getLabel() {
53         return label;
54     }
55 
56     /**
57      * Set literature reference for this item.
58      *
59      @param   item   literature reference.
60      */
61     public final void setItem(final LatexListVo item) {
62         this.item = item;
63     }
64 
65     public final LatexList getItem() {
66         return item;
67     }
68 
69     public boolean equals(final Object obj) {
70         if (!(obj instanceof LiteratureItemVo)) {
71             return false;
72         }
73         final LiteratureItemVo other = (LiteratureItemVoobj;
74         return EqualsUtility.equals(getLabel(), other.getLabel())
75             && EqualsUtility.equals(getItem(), other.getItem());
76     }
77 
78     public int hashCode() {
79         return (getLabel() != null ? getLabel().hashCode() 0)
80             (getItem() != null ^ getItem().hashCode() 0);
81     }
82 
83     public String toString() {
84         final StringBuffer buffer = new StringBuffer();
85         buffer.append("Item label: " + label + "\n");
86         buffer.append(getItem() "\n");
87         return buffer.toString();
88     }
89 
90 }