Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Dez 29 2005 18:38:29 CET
file stats: LOC: 200   Methods: 18
NCLOC: 97   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeBo.java 100% 100% 100% 100%
coverage
 1    /* $Id: NodeBo.java,v 1.4 2005/12/09 18:23:32 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2005, 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.bo.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.4 $
 30    * @author Michael Meyling
 31    */
 32    public final class NodeBo implements Node {
 33   
 34    /** 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  184 public NodeBo() {
 61    // nothing to do
 62    }
 63   
 64    /**
 65    * Set label for referencing.
 66    *
 67    * @param id Label for referencing.
 68    */
 69  138 public final void setId(final String id) {
 70  138 this.id = id;
 71    }
 72   
 73  1034 public final String getId() {
 74  1034 return id;
 75    }
 76   
 77    /**
 78    * Set level of node. Higher levels contain additional informations.
 79    *
 80    * @param level Level.
 81    */
 82  109 public final void setLevel(final String level) {
 83  109 this.level = level;
 84    }
 85   
 86  832 public final String getLevel() {
 87  832 return level;
 88    }
 89   
 90    /**
 91    * Set node name. Could be used as an readable reference,
 92    * e.g. "Axiom of Choice".
 93    *
 94    * @param name Node name.
 95    */
 96  125 public final void setName(final LatexList name) {
 97  125 this.name = name;
 98    }
 99   
 100  860 public final LatexList getName() {
 101  860 return name;
 102    }
 103   
 104    /**
 105    * Set node title. That is a language dependent LaTeX text.
 106    *
 107    * @param title Node title.
 108    */
 109  124 public final void setTitle(final LatexList title) {
 110  124 this.title = title;
 111    }
 112   
 113  884 public final LatexList getTitle() {
 114  884 return title;
 115    }
 116   
 117    /**
 118    * Set receding LaTeX text. This text comes before a theorem, definition etc.
 119    * but belongs to this node regards content.
 120    *
 121    * @param precedingText Preceding LaTeX text.
 122    */
 123  136 public final void setPrecedingText(final LatexList precedingText) {
 124  136 this.precedingText = precedingText;
 125    }
 126   
 127  828 public final LatexList getPrecedingText() {
 128  828 return precedingText;
 129    }
 130   
 131    /**
 132    * Set node type. Contains the concrete theorem or definition or else.
 133    *
 134    * @param nodeType Node type.
 135    */
 136  136 public final void setNodeType(final NodeType nodeType) {
 137  136 this.nodeType = nodeType;
 138    }
 139   
 140  812 public final NodeType getNodeType() {
 141  812 return nodeType;
 142    }
 143   
 144    /**
 145    * Set succeeding LaTeX text. This text comes after a theorem, definition etc.
 146    * but belongs to this node regards content.
 147    *
 148    * @param succeedingText Succeding LaTeX text.
 149    */
 150  123 public final void setSucceedingText(final LatexList succeedingText) {
 151  123 this.succeedingText = succeedingText;
 152    }
 153   
 154  796 public final LatexList getSucceedingText() {
 155  796 return succeedingText;
 156    }
 157   
 158  199 public boolean equals(final Object obj) {
 159  199 if (!(obj instanceof NodeBo)) {
 160  11 return false;
 161    }
 162  188 final NodeBo node = (NodeBo) obj;
 163  188 return EqualsUtility.equals(getId(), node.getId())
 164    && EqualsUtility.equals(getLevel(), node.getLevel())
 165    && EqualsUtility.equals(getName(), node.getName())
 166    && EqualsUtility.equals(getTitle(), node.getTitle())
 167    && EqualsUtility.equals(getPrecedingText(), node.getPrecedingText())
 168    && EqualsUtility.equals(getNodeType(), node.getNodeType())
 169    && EqualsUtility.equals(getSucceedingText(), node.getSucceedingText());
 170    }
 171   
 172  189 public int hashCode() {
 173  189 return (getId() != null ? getId().hashCode() : 0)
 174  189 ^ (getLevel() != null ? 1 ^ getLevel().hashCode() : 0)
 175  189 ^ (getName() != null ? 2 ^ getName().hashCode() : 0)
 176  189 ^ (getTitle() != null ? 3 ^ getTitle().hashCode() : 0)
 177  189 ^ (getPrecedingText() != null ? 4 ^ getPrecedingText().hashCode() : 0)
 178  189 ^ (getNodeType() != null ? 5 ^ getNodeType().hashCode() : 0)
 179  189 ^ (getSucceedingText() != null ? 6 ^ getSucceedingText().hashCode() : 0);
 180    }
 181   
 182  147 public String toString() {
 183  147 final StringBuffer buffer = new StringBuffer();
 184  147 buffer.append("Node\t");
 185  147 buffer.append("Label: " + getId());
 186  147 buffer.append("\tLevel: " + getLevel() + "\n");
 187  147 buffer.append("Name: ");
 188  147 buffer.append(getName() + "\n\n");
 189  147 buffer.append("Title: ");
 190  147 buffer.append(getTitle() + "\n\n");
 191  147 buffer.append("Pre: ");
 192  147 buffer.append(getPrecedingText() + "\n\n");
 193  147 buffer.append("NodeType: ");
 194  147 buffer.append(getNodeType() + "\n\n");
 195  147 buffer.append("Suc: ");
 196  147 buffer.append(getSucceedingText() + "\n\n");
 197  147 return buffer.toString();
 198    }
 199   
 200    }