Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Mai 10 2007 03:16:40 CEST
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.8 2007/05/10 00:37:50 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, 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.8 $
 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  1542 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  1496 public final void setId(final String id) {
 70  1496 this.id = id;
 71    }
 72   
 73  5467 public final String getId() {
 74  5467 return id;
 75    }
 76   
 77    /**
 78    * Set node level.
 79    *
 80    * @param level Level of this node.
 81    */
 82  1305 public final void setLevel(final String level) {
 83  1305 this.level = level;
 84    }
 85   
 86  2391 public final String getLevel() {
 87  2391 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  778 public final void setName(final LatexListVo name) {
 96  778 this.name = name;
 97    }
 98   
 99  204713 public final LatexList getName() {
 100  204713 return name;
 101    }
 102   
 103    /**
 104    * Set node title.
 105    *
 106    * @param title Title of node.
 107    */
 108  773 public final void setTitle(final LatexListVo title) {
 109  773 this.title = title;
 110    }
 111   
 112  203780 public final LatexList getTitle() {
 113  203780 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  1452 public final void setPrecedingText(final LatexListVo precedingText) {
 123  1452 this.precedingText = precedingText;
 124    }
 125   
 126  270724 public final LatexList getPrecedingText() {
 127  270724 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  1494 public final void setNodeType(final NodeType nodeType) {
 136  1494 this.nodeType = nodeType;
 137    }
 138   
 139  711489 public final NodeType getNodeType() {
 140  711489 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  421 public final void setSucceedingText(final LatexListVo succeedingText) {
 150  421 this.succeedingText = succeedingText;
 151    }
 152   
 153  140331 public final LatexList getSucceedingText() {
 154  140331 return succeedingText;
 155    }
 156   
 157  240 public boolean equals(final Object obj) {
 158  240 if (!(obj instanceof NodeVo)) {
 159  10 return false;
 160    }
 161  230 final NodeVo node = (NodeVo) obj;
 162  230 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  219 public int hashCode() {
 172  219 return (getId() != null ? getId().hashCode() : 0)
 173  219 ^ (getLevel() != null ? 1 ^ getLevel().hashCode() : 0)
 174  219 ^ (getName() != null ? 2 ^ getName().hashCode() : 0)
 175  219 ^ (getTitle() != null ? 3 ^ getTitle().hashCode() : 0)
 176  219 ^ (getPrecedingText() != null ? 4 ^ getPrecedingText().hashCode() : 0)
 177  219 ^ (getNodeType() != null ? 5 ^ getNodeType().hashCode() : 0)
 178  219 ^ (getSucceedingText() != null ? 6 ^ getSucceedingText().hashCode() : 0);
 179    }
 180   
 181  173 public String toString() {
 182  173 final StringBuffer buffer = new StringBuffer();
 183  173 buffer.append("Node\t");
 184  173 buffer.append("Id: " + getId());
 185  173 buffer.append("\tLevel: " + getLevel() + "\n");
 186  173 buffer.append("Name: ");
 187  173 buffer.append(getName() + "\n\n");
 188  173 buffer.append("Title: ");
 189  173 buffer.append(getTitle() + "\n\n");
 190  173 buffer.append("Pre: ");
 191  173 buffer.append(getPrecedingText() + "\n\n");
 192  173 buffer.append("NodeType: ");
 193  173 buffer.append(getNodeType() + "\n\n");
 194  173 buffer.append("Suc: ");
 195  173 buffer.append(getSucceedingText() + "\n\n");
 196  173 return buffer.toString();
 197    }
 198   
 199    }