www.sdmetrics.com

com.sdmetrics.metrics
Class ElementGraph

java.lang.Object
  extended by com.sdmetrics.metrics.ElementGraph
All Implemented Interfaces:
StronglyConnectedComponents.Graph<ModelElement>

public class ElementGraph
extends java.lang.Object
implements StronglyConnectedComponents.Graph<ModelElement>

A graph consisting of model elements.

The edges of the graph are defined by a set expression, which yields, for a model element e, the set of neighbor elements to which there is an outgoing edge from e.


Constructor Summary
ElementGraph(MetricsEngine engine, java.util.Collection<ModelElement> nodes, ExpressionNode neighbors, Variables vars)
           
 
Method Summary
 java.util.Collection<ModelElement> getNeighbors(ModelElement element)
          Obtains, for a node, the set of nodes to which it has an outgoing edge.
 java.util.Collection<ModelElement> getNodes()
          Retrieves the set of nodes of the graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementGraph

public ElementGraph(MetricsEngine engine,
                    java.util.Collection<ModelElement> nodes,
                    ExpressionNode neighbors,
                    Variables vars)
Parameters:
engine - Metrics engine to calculate the neighbors of a model element.
nodes - The model elements that constitute the nodes of the graph.
neighbors - Set expression that yields the set of neighbors of a model element.
vars - Variables for the expression evaluation
Method Detail

getNodes

public java.util.Collection<ModelElement> getNodes()
Description copied from interface: StronglyConnectedComponents.Graph
Retrieves the set of nodes of the graph.

Specified by:
getNodes in interface StronglyConnectedComponents.Graph<ModelElement>
Returns:
A collection of objects that constitute the nodes of the graph.

getNeighbors

public java.util.Collection<ModelElement> getNeighbors(ModelElement element)
                                                throws SDMetricsException
Description copied from interface: StronglyConnectedComponents.Graph
Obtains, for a node, the set of nodes to which it has an outgoing edge.

Specified by:
getNeighbors in interface StronglyConnectedComponents.Graph<ModelElement>
Parameters:
element - The node for which to obtain the neighbor nodes.
Returns:
A collection of the neighbor nodes to which node has an outgoing edge.
Throws:
SDMetricsException - if the neighbors for a node could not be determined.

www.sdmetrics.com