public class ElementGraph extends java.lang.Object implements StronglyConnectedComponents.Graph<ModelElement>
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 and Description |
---|
ElementGraph(MetricsEngine engine,
java.util.Collection<ModelElement> nodes,
ExpressionNode neighbors,
Variables vars)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public ElementGraph(MetricsEngine engine, java.util.Collection<ModelElement> nodes, ExpressionNode neighbors, Variables vars)
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 evaluationpublic java.util.Collection<ModelElement> getNodes()
StronglyConnectedComponents.Graph
getNodes
in interface StronglyConnectedComponents.Graph<ModelElement>
public java.util.Collection<ModelElement> getNeighbors(ModelElement element) throws SDMetricsException
StronglyConnectedComponents.Graph
getNeighbors
in interface StronglyConnectedComponents.Graph<ModelElement>
element
- The node for which to obtain the neighbor nodes.node
has an outgoing edge.SDMetricsException
- if the neighbors for a node could not be
determined.