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