Clover coverage report - baseCode - 0.2.5
Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT
file stats: LOC: 101   Methods: 12
NCLOC: 49   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
AbstractGraphNode.java - 66.7% 66.7% 66.7%
coverage coverage
 1   
 package baseCode.dataStructure.graph;
 2   
 
 3   
 import org.apache.commons.logging.Log;
 4   
 import org.apache.commons.logging.LogFactory;
 5   
 
 6   
 import baseCode.common.Visitable;
 7   
 
 8   
 /**
 9   
  * <p>
 10   
  * Copyright (c) Columbia University
 11   
  * 
 12   
  * @author Paul Pavlidis
 13   
  * @version $Id: AbstractGraphNode.java,v 1.9 2004/07/29 08:38:49 pavlidis Exp $
 14   
  */
 15   
 public abstract class AbstractGraphNode extends Visitable implements GraphNode {
 16   
    protected Object key;
 17   
    protected Object item;
 18   
    protected Graph graph; // the graph this belongs to.
 19   
    protected boolean visited = false;
 20   
    protected static Log log = LogFactory.getLog( GraphNode.class );
 21   
 
 22   
    /**
 23   
     * Get the actual contents of the node.
 24   
     * 
 25   
     * @return
 26   
     */
 27  284
    public Object getItem() {
 28  284
       return item;
 29   
    }
 30   
 
 31   
    /**
 32   
     * Get the key for the node.
 33   
     * 
 34   
     * @return Object
 35   
     */
 36  4
    public Object getKey() {
 37  4
       return key;
 38   
    }
 39   
 
 40   
    /**
 41   
     * Create a new node with key and value given. The key is stored by the graph and is used to retrieve nodes. Keys and
 42   
     * nodes can be any kind of object.
 43   
     * 
 44   
     * @param key
 45   
     * @param value
 46   
     * @param graph
 47   
     */
 48  117
    public AbstractGraphNode( Object key, Object value, Graph graph ) {
 49  117
       this.setValue( key, value );
 50  117
       this.graph = graph;
 51   
    }
 52   
 
 53   
    /**
 54   
     * Create a new node when given only a key.
 55   
     * 
 56   
     * @param key
 57   
     */
 58  0
    public AbstractGraphNode( Object key ) {
 59  0
       this.key = key;
 60  0
       this.item = null;
 61   
    }
 62   
 
 63   
    /**
 64   
     * Set the graph this belongs to.
 65   
     * 
 66   
     * @param graph Graph
 67   
     */
 68  4
    public void setGraph( Graph graph ) {
 69  4
       this.graph = graph;
 70   
    }
 71   
 
 72  117
    public void setValue( Object key, Object value ) {
 73  117
       this.item = value;
 74  117
       this.key = key;
 75   
    }
 76   
 
 77  0
    public void setItem( Object value ) {
 78  0
       this.item = value;
 79   
    }
 80   
 
 81  0
    public String toString() {
 82  0
       return item.toString();
 83   
    }
 84   
 
 85  349
    public Graph getGraph() {
 86  349
       return graph;
 87   
    }
 88   
 
 89  76
    public void mark() {
 90  76
       visited = true;
 91   
    }
 92   
 
 93  0
    public void unMark() {
 94  0
       visited = false;
 95   
    }
 96   
 
 97  149
    public boolean isVisited() {
 98  149
       return visited;
 99   
    }
 100   
 
 101   
 }