baseCode.dataStructure.graph
Class AbstractGraphNode

java.lang.Object
  extended bybaseCode.common.Visitable
      extended bybaseCode.dataStructure.graph.AbstractGraphNode
All Implemented Interfaces:
java.lang.Comparable, GraphNode
Direct Known Subclasses:
DirectedGraphNode, UndirectedGraphNode

public abstract class AbstractGraphNode
extends Visitable
implements GraphNode

Copyright (c) Columbia University

Version:
$Id: AbstractGraphNode.java,v 1.9 2004/07/29 08:38:49 pavlidis Exp $
Author:
Paul Pavlidis

Field Summary
protected  Graph graph
           
protected  java.lang.Object item
           
protected  java.lang.Object key
           
protected static org.apache.commons.logging.Log log
           
protected  boolean visited
           
 
Constructor Summary
AbstractGraphNode(java.lang.Object key)
          Create a new node when given only a key.
AbstractGraphNode(java.lang.Object key, java.lang.Object value, Graph graph)
          Create a new node with key and value given.
 
Method Summary
 Graph getGraph()
           
 java.lang.Object getItem()
          Get the actual contents of the node.
 java.lang.Object getKey()
          Get the key for the node.
 boolean isVisited()
           
 void mark()
           
 void setGraph(Graph graph)
          Set the graph this belongs to.
 void setItem(java.lang.Object value)
          Set the contents of the node.
 void setValue(java.lang.Object key, java.lang.Object value)
          Set the key and value associated with this node.
 java.lang.String toString()
           
 void unMark()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

key

protected java.lang.Object key

item

protected java.lang.Object item

graph

protected Graph graph

visited

protected boolean visited

log

protected static org.apache.commons.logging.Log log
Constructor Detail

AbstractGraphNode

public AbstractGraphNode(java.lang.Object key,
                         java.lang.Object value,
                         Graph graph)
Create a new node with key and value given. The key is stored by the graph and is used to retrieve nodes. Keys and nodes can be any kind of object.

Parameters:
key -
value -
graph -

AbstractGraphNode

public AbstractGraphNode(java.lang.Object key)
Create a new node when given only a key.

Parameters:
key -
Method Detail

getItem

public java.lang.Object getItem()
Get the actual contents of the node.

Specified by:
getItem in interface GraphNode
Returns:

getKey

public java.lang.Object getKey()
Get the key for the node.

Specified by:
getKey in interface GraphNode
Returns:
Object

setGraph

public void setGraph(Graph graph)
Set the graph this belongs to.

Specified by:
setGraph in interface GraphNode
Parameters:
graph - Graph

setValue

public void setValue(java.lang.Object key,
                     java.lang.Object value)
Description copied from interface: GraphNode
Set the key and value associated with this node.

Specified by:
setValue in interface GraphNode
Parameters:
key -
value -

setItem

public void setItem(java.lang.Object value)
Description copied from interface: GraphNode
Set the contents of the node.

Specified by:
setItem in interface GraphNode
Parameters:
value -

toString

public java.lang.String toString()

getGraph

public Graph getGraph()
Specified by:
getGraph in interface GraphNode
Returns:
the Graph this belongs to.

mark

public void mark()
Overrides:
mark in class Visitable

unMark

public void unMark()
Overrides:
unMark in class Visitable

isVisited

public boolean isVisited()
Overrides:
isVisited in class Visitable


Copyright © 2003-2005 Columbia University. All Rights Reserved.