org.eigenbase.jmi
Class JmiDependencyGraph

java.lang.Object
  extended by org.jgrapht.graph.AbstractGraph<V,E>
      extended by org.jgrapht.graph.GraphDelegator<V,E>
          extended by org.jgrapht.graph.UnmodifiableGraph<V,E>
              extended by org.jgrapht.graph.UnmodifiableDirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge>
                  extended by org.eigenbase.jmi.JmiDependencyGraph
All Implemented Interfaces:
Serializable, org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge>, org.jgrapht.Graph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge>

public class JmiDependencyGraph
extends org.jgrapht.graph.UnmodifiableDirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge>

JmiDependencyGraph is a directed graph representation of the dependencies spanning a set of JMI objects. Vertices are instances of JmiDependencyVertex. Graph instances are immutable and can be accessed concurrently by multiple threads.

The rules for determining dependencies from a set of JMI objects and their associations are supplied to the constructor via an instance of JmiDependencyTransform. This allows the caller to define the dependencies of interest for a particular model or application.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/jmi/JmiDependencyGraph.java#12 $
Author:
John V. Sichi
See Also:
Serialized Form

Field Summary
private  org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> hierarchyGraph
           
private  org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> mutableGraph
          The underlying graph structure; we hide it here so that it can only be modified internally.
private  JmiDependencyTransform transform
           
private  Map<RefObject,JmiDependencyVertex> vertexMap
           
 
Constructor Summary
  JmiDependencyGraph(Collection<RefObject> elements, JmiDependencyTransform transform)
          Creates a new dependency graph.
private JmiDependencyGraph(Collection<RefObject> elements, JmiDependencyTransform transform, org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> mutableGraph)
           
 
Method Summary
private  void addDependencyEdges(Collection<RefObject> elements, JmiAssocMapping mapping)
           
private  void addElements(Collection<RefObject> elements)
           
private  void addElementToVertex(RefObject refObj, JmiDependencyVertex vertex)
           
private  void addHierarchyEdges(Collection<RefObject> elements)
           
 org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> getHierarchyGraph()
           
 Map<RefObject,JmiDependencyVertex> getVertexMap()
           
 
Methods inherited from class org.jgrapht.graph.UnmodifiableGraph
addEdge, addEdge, addVertex, removeAllEdges, removeAllEdges, removeAllVertices, removeEdge, removeEdge, removeVertex
 
Methods inherited from class org.jgrapht.graph.GraphDelegator
containsEdge, containsVertex, degreeOf, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf, setEdgeWeight, toString, vertexSet
 
Methods inherited from class org.jgrapht.graph.AbstractGraph
assertVertexExist, containsEdge, removeAllEdges, toStringFromSets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jgrapht.DirectedGraph
incomingEdgesOf, inDegreeOf, outDegreeOf, outgoingEdgesOf
 
Methods inherited from interface org.jgrapht.Graph
addEdge, addEdge, addVertex, containsEdge, containsEdge, containsVertex, edgeSet, edgesOf, getAllEdges, getEdge, getEdgeFactory, getEdgeSource, getEdgeTarget, getEdgeWeight, removeAllEdges, removeAllEdges, removeAllVertices, removeEdge, removeEdge, removeVertex, vertexSet
 

Field Detail

mutableGraph

private final org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> mutableGraph
The underlying graph structure; we hide it here so that it can only be modified internally.


transform

private final JmiDependencyTransform transform

vertexMap

private Map<RefObject,JmiDependencyVertex> vertexMap

hierarchyGraph

private org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> hierarchyGraph
Constructor Detail

JmiDependencyGraph

public JmiDependencyGraph(Collection<RefObject> elements,
                          JmiDependencyTransform transform)
Creates a new dependency graph.

Parameters:
elements - the elements among which dependencies are to be determined
transform - rules for finding dependencies and grouping elements

JmiDependencyGraph

private JmiDependencyGraph(Collection<RefObject> elements,
                           JmiDependencyTransform transform,
                           org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> mutableGraph)
Method Detail

getVertexMap

public Map<RefObject,JmiDependencyVertex> getVertexMap()
Returns:
an immutable map from an object in the graph to its containing JmiDependencyVertex

getHierarchyGraph

public org.jgrapht.DirectedGraph<JmiDependencyVertex,org.jgrapht.graph.DefaultEdge> getHierarchyGraph()
Returns:
immutable graph of hierarchy relationships imposed on vertices

addElements

private void addElements(Collection<RefObject> elements)

addDependencyEdges

private void addDependencyEdges(Collection<RefObject> elements,
                                JmiAssocMapping mapping)

addHierarchyEdges

private void addHierarchyEdges(Collection<RefObject> elements)

addElementToVertex

private void addElementToVertex(RefObject refObj,
                                JmiDependencyVertex vertex)