baseCode.dataStructure.graph
Class AbstractGraph

java.lang.Object
  extended bybaseCode.dataStructure.graph.AbstractGraph
All Implemented Interfaces:
Graph
Direct Known Subclasses:
DirectedGraph

public abstract class AbstractGraph
extends java.lang.Object
implements Graph

Copyright (c) Columbia University

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

Field Summary
protected  java.util.Map items
           
 
Constructor Summary
AbstractGraph()
           
AbstractGraph(java.util.Set nodes)
          Create a new graph from a set of nodes.
 
Method Summary
 void addNode(GraphNode node)
           
 boolean containsKey(java.lang.Object key)
           
 GraphNode get(java.lang.Object key)
          Retrieve a node by key.
 java.util.Map getItems()
           
 java.lang.Object getNodeContents(java.lang.Object key)
          Retrieve the contents of a node by key.
 void unmarkAll()
          Reset the 'visited' marks of the graph to false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface baseCode.dataStructure.graph.Graph
addNode
 

Field Detail

items

protected java.util.Map items
Constructor Detail

AbstractGraph

public AbstractGraph()

AbstractGraph

public AbstractGraph(java.util.Set nodes)
Create a new graph from a set of nodes. This allows us to easily make subtrees.

Parameters:
nodes - Set of AbstractGraphNodes.
Method Detail

addNode

public void addNode(GraphNode node)
Parameters:
node - GraphNode

get

public GraphNode get(java.lang.Object key)
Retrieve a node by key. To get the contents of a node use getNodeContents(key)

Specified by:
get in interface Graph
Parameters:
key - Object
Returns:
AbstractGraphNode referenced by the key.
See Also:
getNodeContents(Object)

getItems

public java.util.Map getItems()
Returns:
Map

getNodeContents

public java.lang.Object getNodeContents(java.lang.Object key)
Retrieve the contents of a node by key.

Specified by:
getNodeContents in interface Graph
Parameters:
key - Object
Returns:
The object contained by a node, not the node itself.
See Also:
get(java.lang.Object)

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface Graph
Parameters:
key - Object
Returns:
true if the graph contains an item referenced by key, false otherwise.

unmarkAll

public void unmarkAll()
Reset the 'visited' marks of the graph to false.

Specified by:
unmarkAll in interface Graph


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