org.progeeks.graph
Class MapGraph
java.lang.Object
com.phoenixst.plexus.AbstractGraph
org.progeeks.graph.MapGraph
- All Implemented Interfaces:
- com.phoenixst.plexus.Graph
public class MapGraph
- extends com.phoenixst.plexus.AbstractGraph
Wraps a Map object to provide a Graph view. This is not
just a pass-through wrapper since the semantics of maps
are slightly different than that of a graph. Edges require
that nodes already exist in the graph and therefore, disconnected
nodes are kept in a separate structure until connected. They
also go back to this structure if the edges are removed.
- Version:
- $Revision: 1.5 $
- Author:
- Paul Speed
Nested classes/interfaces inherited from interface com.phoenixst.plexus.Graph |
com.phoenixst.plexus.Graph.Edge |
Constructor Summary |
MapGraph(java.util.Map map)
|
MapGraph(java.util.Map map,
java.lang.Object edge,
boolean fullyConnect)
Creates a Graph view of the specified map. |
Method Summary |
com.phoenixst.plexus.Graph.Edge |
addEdge(java.lang.Object o,
java.lang.Object tail,
java.lang.Object head,
boolean isDirected)
|
boolean |
addNode(java.lang.Object node)
|
boolean |
containsNode(java.lang.Object node)
|
protected java.util.Collection |
edges()
|
protected com.phoenixst.plexus.Traverser |
fullTraverser(java.lang.Object node)
|
protected java.util.Collection |
nodes()
|
protected com.phoenixst.plexus.Traverser |
quickTraverser(java.lang.Object node)
|
boolean |
removeEdge(com.phoenixst.plexus.Graph.Edge edge)
|
boolean |
removeNode(java.lang.Object node)
|
protected com.phoenixst.plexus.Traverser |
traverser(java.lang.Object node)
|
Methods inherited from class com.phoenixst.plexus.AbstractGraph |
adjacentNodes, containsEdge, degree, degree, edges, getAdjacentNode, getEdge, getIncidentEdge, getNode, incidentEdges, nodes, traverser |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MapGraph
public MapGraph(java.util.Map map)
MapGraph
public MapGraph(java.util.Map map,
java.lang.Object edge,
boolean fullyConnect)
- Creates a Graph view of the specified map.
- Parameters:
map
- The Map object for which to provide a view.edge
- The edge object to use as the user edge object.fullyConnect
- When true, keys that are also values
will be included in traversals.
nodes
protected java.util.Collection nodes()
- Specified by:
nodes
in class com.phoenixst.plexus.AbstractGraph
edges
protected java.util.Collection edges()
- Specified by:
edges
in class com.phoenixst.plexus.AbstractGraph
traverser
protected com.phoenixst.plexus.Traverser traverser(java.lang.Object node)
- Specified by:
traverser
in class com.phoenixst.plexus.AbstractGraph
containsNode
public boolean containsNode(java.lang.Object node)
- Specified by:
containsNode
in interface com.phoenixst.plexus.Graph
- Overrides:
containsNode
in class com.phoenixst.plexus.AbstractGraph
addNode
public boolean addNode(java.lang.Object node)
- Specified by:
addNode
in interface com.phoenixst.plexus.Graph
- Overrides:
addNode
in class com.phoenixst.plexus.AbstractGraph
removeNode
public boolean removeNode(java.lang.Object node)
- Specified by:
removeNode
in interface com.phoenixst.plexus.Graph
- Overrides:
removeNode
in class com.phoenixst.plexus.AbstractGraph
addEdge
public com.phoenixst.plexus.Graph.Edge addEdge(java.lang.Object o,
java.lang.Object tail,
java.lang.Object head,
boolean isDirected)
- Specified by:
addEdge
in interface com.phoenixst.plexus.Graph
- Overrides:
addEdge
in class com.phoenixst.plexus.AbstractGraph
removeEdge
public boolean removeEdge(com.phoenixst.plexus.Graph.Edge edge)
- Specified by:
removeEdge
in interface com.phoenixst.plexus.Graph
- Overrides:
removeEdge
in class com.phoenixst.plexus.AbstractGraph
fullTraverser
protected com.phoenixst.plexus.Traverser fullTraverser(java.lang.Object node)
quickTraverser
protected com.phoenixst.plexus.Traverser quickTraverser(java.lang.Object node)
Copyright © 2002-2003 Paul Speed. All Rights Reserved.