Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 199   Methods: 18
NCLOC: 97   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeVo.java 100% 100% 100% 100%
coverage
 1    /* $Id: NodeVo.java,v 1.5 2006/10/20 20:23:01 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.kernel.base.module.LatexList;
 21    import org.qedeq.kernel.base.module.Node;
 22    import org.qedeq.kernel.base.module.NodeType;
 23    import org.qedeq.kernel.utility.EqualsUtility;
 24   
 25   
 26    /**
 27    * Special subsection of a qedeq file.
 28    *
 29    * @version $Revision: 1.5 $
 30    * @author Michael Meyling
 31    */
 32    public final 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  814 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  768 public final void setId(final String id) {
 70  768 this.id = id;
 71    }
 72   
 73  3143 public final String getId() {
 74  3143 return id;
 75    }
 76   
 77    /**
 78    * Set node level.
 79    *
 80    * @param level Level of this node.
 81    */
 82  676 public final void setLevel(final String level) {
 83  676 this.level = level;
 84    }
 85   
 86  1576 public final String getLevel() {
 87  1576 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  431 public final void setName(final LatexListVo name) {
 96  431 this.name = name;
 97    }
 98   
 99  1948 public final LatexList getName() {
 100  1948 return name;
 101    }
 102   
 103    /**
 104    * Set node title.
 105    *
 106    * @param title Title of node.
 107    */
 108  426 public final void setTitle(final LatexListVo title) {
 109  426 this.title = title;
 110    }
 111   
 112  2218 public final LatexList getTitle() {
 113  2218 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  766 public final void setPrecedingText(final LatexListVo precedingText) {
 123  766 this.precedingText = precedingText;
 124    }
 125   
 126  2574 public final LatexList getPrecedingText() {
 127  2574 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  766 public final void setNodeType(final NodeType nodeType) {
 136  766 this.nodeType = nodeType;
 137    }
 138   
 139  4570 public final NodeType getNodeType() {
 140  4570 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  273 public final void setSucceedingText(final LatexListVo succeedingText) {
 150  273 this.succeedingText = succeedingText;
 151    }
 152   
 153  1822 public final LatexList getSucceedingText() {
 154  1822 return succeedingText;
 155    }
 156   
 157  233 public boolean equals(final Object obj) {
 158  233 if (!(obj instanceof NodeVo)) {
 159  10 return false;
 160    }
 161  223 final NodeVo node = (NodeVo) obj;
 162  223 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  217 public int hashCode() {
 172  217 return (getId() != null ? getId().hashCode() : 0)
 173  217 ^ (getLevel() != null ? 1 ^ getLevel().hashCode() : 0)
 174  217 ^ (getName() != null ? 2 ^ getName().hashCode() : 0)
 175  217 ^ (getTitle() != null ? 3 ^ getTitle().hashCode() : 0)
 176  217 ^ (getPrecedingText() != null ? 4 ^ getPrecedingText().hashCode() : 0)
 177  217 ^ (getNodeType() != null ? 5 ^ getNodeType().hashCode() : 0)
 178  217 ^ (getSucceedingText() != null ? 6 ^ getSucceedingText().hashCode() : 0);
 179    }
 180   
 181  171 public String toString() {
 182  171 final StringBuffer buffer = new StringBuffer();
 183  171 buffer.append("Node\t");
 184  171 buffer.append("Id: " + getId());
 185  171 buffer.append("\tLevel: " + getLevel() + "\n");
 186  171 buffer.append("Name: ");
 187  171 buffer.append(getName() + "\n\n");
 188  171 buffer.append("Title: ");
 189  171 buffer.append(getTitle() + "\n\n");
 190  171 buffer.append("Pre: ");
 191  171 buffer.append(getPrecedingText() + "\n\n");
 192  171 buffer.append("NodeType: ");
 193  171 buffer.append(getNodeType() + "\n\n");
 194  171 buffer.append("Suc: ");
 195  171 buffer.append(getSucceedingText() + "\n\n");
 196  171 return buffer.toString();
 197    }
 198   
 199    }