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.LatexList;
020 import org.qedeq.kernel.se.base.module.Subsection;
021
022
023 /**
024 * Subsection of a qedeq file.
025 *
026 * @author Michael Meyling
027 */
028 public class SubsectionVo implements Subsection {
029
030 /** Label for referencing. */
031 private String id;
032
033 /** Level of that subsection. Higher levels contain additional informations. */
034 private String level;
035
036 /** Title of this subsection. */
037 private LatexList title;
038
039 /** LaTeX text. */
040 private LatexList latex;
041
042 /**
043 * Constructs a new empty subsection.
044 */
045 public SubsectionVo() {
046 // nothing to do
047 }
048
049 /**
050 * Set label for this subsection.
051 *
052 * @param label Label for referencing.
053 */
054 public final void setId(final String label) {
055 this.id = label;
056 }
057
058 public final String getId() {
059 return id;
060 }
061
062 /**
063 * Set level for this section. Higher levels contain additional informations
064 *
065 * @param level Level of that subsection.
066 */
067 public final void setLevel(final String level) {
068 this.level = level;
069 }
070
071 public final String getLevel() {
072 return level;
073 }
074
075 /**
076 * Set title of this subsection.
077 *
078 * @param title Subsection title.
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 LaTeX text for this subsection.
090 *
091 * @param latexText LaTeX text.
092 */
093 public final void setLatex(final LatexListVo latexText) {
094 this.latex = latexText;
095 }
096
097 public final LatexList getLatex() {
098 return latex;
099 }
100
101 public boolean equals(final Object obj) {
102 if (!(obj instanceof SubsectionVo)) {
103 return false;
104 }
105 final SubsectionVo subsection = (SubsectionVo) obj;
106 return EqualsUtility.equals(getId(), subsection.getId())
107 && EqualsUtility.equals(getLevel(), subsection.getLevel())
108 && EqualsUtility.equals(getTitle(), subsection.getTitle())
109 && EqualsUtility.equals(getLatex(), subsection.getLatex());
110 }
111
112 public int hashCode() {
113 return (getId() != null ? getId().hashCode() : 0)
114 ^ (getLevel() != null ? 1 ^ getLevel().hashCode() : 0)
115 ^ (getTitle() != null ? 2 ^ getTitle().hashCode() : 0)
116 ^ (getLatex() != null ? 3 ^ getLatex().hashCode() : 0);
117 }
118
119 public String toString() {
120 final StringBuffer buffer = new StringBuffer();
121 buffer.append("Subsection\t");
122 buffer.append("Label: " + getId());
123 buffer.append("\tLevel: " + getLevel() + "\n");
124 buffer.append("Title: ");
125 buffer.append(getTitle() + "\n\n");
126 buffer.append("Pre: ");
127 buffer.append(getLatex() + "\n\n");
128 return buffer.toString();
129 }
130
131 }
|