Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
34   199   19   1,89
16   97   0,56   18
18     1,06  
1    
 
  NodeVo       Line # 32 34 19 100% 1.0
 
  (40)
 
1    /* $Id: NodeVo.java,v 1.10 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.LatexList;
22    import org.qedeq.kernel.base.module.Node;
23    import org.qedeq.kernel.base.module.NodeType;
24   
25   
26    /**
27    * Special subsection of a qedeq file.
28    *
29    * @version $Revision: 1.10 $
30    * @author Michael Meyling
31    */
 
32    public class NodeVo implements Node {
33   
34    /** Module unique label for referencing. */
35    private String id;
36   
37    /** Level of that node. Higher levels contain additional informations. */
38    private String level;
39   
40    /** Node name. Could be used as an readable reference, e.g. "Axiom of Choice". */
41    private LatexList name;
42   
43    /** Title of this subsection. */
44    private LatexList title;
45   
46    /** Preceding LaTeX text. This text comes before a theorem, definition etc.
47    * but belongs to this node regards content. */
48    private LatexList precedingText;
49   
50    /** Contains the concrete theorem or definition or else. */
51    private NodeType nodeType;
52   
53    /** Succeeding LaTeX text. This text comes after a theorem, definition etc.
54    * but belongs to this node regards content. */
55    private LatexList succeedingText;
56   
57    /**
58    * Constructs a new empty node.
59    */
 
60  2379 toggle public NodeVo() {
61    // nothing to do
62    }
63   
64    /**
65    * Set label for this node. Referencing must use this label.
66    *
67    * @param id Label for referencing.
68    */
 
69  2333 toggle public final void setId(final String id) {
70  2333 this.id = id;
71    }
72   
 
73  8144 toggle public final String getId() {
74  8144 return id;
75    }
76   
77    /**
78    * Set node level.
79    *
80    * @param level Level of this node.
81    */
 
82  1839 toggle public final void setLevel(final String level) {
83  1839 this.level = level;
84    }
85   
 
86  2799 toggle public final String getLevel() {
87  2799 return level;
88    }
89   
90    /**
91    * Set node name. Could be used as an readable reference, e.g. "Axiom of Choice".
92    *
93    * @param name Name of this node.
94    */
 
95  1408 toggle public final void setName(final LatexListVo name) {
96  1408 this.name = name;
97    }
98   
 
99  229155 toggle public final LatexList getName() {
100  229155 return name;
101    }
102   
103    /**
104    * Set node title.
105    *
106    * @param title Title of node.
107    */
 
108  1403 toggle public final void setTitle(final LatexListVo title) {
109  1403 this.title = title;
110    }
111   
 
112  228177 toggle public final LatexList getTitle() {
113  228177 return title;
114    }
115   
116    /**
117    * Set preceding LaTeX text. This text comes before a theorem, definition etc.
118    * but belongs to this node regards content.
119    *
120    * @param precedingText Preceding LaTeX text.
121    */
 
122  2005 toggle public final void setPrecedingText(final LatexListVo precedingText) {
123  2005 this.precedingText = precedingText;
124    }
125   
 
126  296578 toggle public final LatexList getPrecedingText() {
127  296578 return precedingText;
128    }
129   
130    /**
131    * Set the concrete theorem or definition or else.
132    *
133    * @param nodeType An instance of {@link NodeType}.
134    */
 
135  2331 toggle public final void setNodeType(final NodeType nodeType) {
136  2331 this.nodeType = nodeType;
137    }
138   
 
139  785368 toggle public final NodeType getNodeType() {
140  785368 return nodeType;
141    }
142   
143    /**
144    * Set succeeding LaTeX text. This text comes after a theorem, definition etc.
145    * but belongs to this node regards content.
146    *
147    * @param succeedingText Succeeding LaTeX text.
148    */
 
149  537 toggle public final void setSucceedingText(final LatexListVo succeedingText) {
150  537 this.succeedingText = succeedingText;
151    }
152   
 
153  153269 toggle public final LatexList getSucceedingText() {
154  153269 return succeedingText;
155    }
156   
 
157  212 toggle public boolean equals(final Object obj) {
158  212 if (!(obj instanceof NodeVo)) {
159  10 return false;
160    }
161  202 final NodeVo node = (NodeVo) obj;
162  202 return EqualsUtility.equals(getId(), node.getId())
163    && EqualsUtility.equals(getLevel(), node.getLevel())
164    && EqualsUtility.equals(getName(), node.getName())
165    && EqualsUtility.equals(getTitle(), node.getTitle())
166    && EqualsUtility.equals(getPrecedingText(), node.getPrecedingText())
167    && EqualsUtility.equals(getNodeType(), node.getNodeType())
168    && EqualsUtility.equals(getSucceedingText(), node.getSucceedingText());
169    }
170   
 
171  195 toggle public int hashCode() {
172  195 return (getId() != null ? getId().hashCode() : 0)
173  195 ^ (getLevel() != null ? 1 ^ getLevel().hashCode() : 0)
174  195 ^ (getName() != null ? 2 ^ getName().hashCode() : 0)
175  195 ^ (getTitle() != null ? 3 ^ getTitle().hashCode() : 0)
176  195 ^ (getPrecedingText() != null ? 4 ^ getPrecedingText().hashCode() : 0)
177  195 ^ (getNodeType() != null ? 5 ^ getNodeType().hashCode() : 0)
178  195 ^ (getSucceedingText() != null ? 6 ^ getSucceedingText().hashCode() : 0);
179    }
180   
 
181  143 toggle public String toString() {
182  143 final StringBuffer buffer = new StringBuffer();
183  143 buffer.append("Node\t");
184  143 buffer.append("Id: " + getId());
185  143 buffer.append("\tLevel: " + getLevel() + "\n");
186  143 buffer.append("Name: ");
187  143 buffer.append(getName() + "\n\n");
188  143 buffer.append("Title: ");
189  143 buffer.append(getTitle() + "\n\n");
190  143 buffer.append("Pre: ");
191  143 buffer.append(getPrecedingText() + "\n\n");
192  143 buffer.append("NodeType: ");
193  143 buffer.append(getNodeType() + "\n\n");
194  143 buffer.append("Suc: ");
195  143 buffer.append(getSucceedingText() + "\n\n");
196  143 return buffer.toString();
197    }
198   
199    }