use of com.github.sevntu.checkstyle.dot.domain.Cluster in project methods-distance by sevntu-checkstyle.
the class DependencyInfoGraphSerializer method serializeInfo.
public static String serializeInfo(Dependencies dependencies) {
final MethodOrder info = new MethodOrder(dependencies);
final Graph graph = new Graph("dependencies");
graph.setRankdir(Rankdirs.LR);
final Cluster simpleMethods = new Cluster("simple");
final Map<Method, Node> methodToNode = info.getMethods().stream().filter(method -> !info.isInterfaceMethod(method)).collect(Collectors.toMap(Function.identity(), DependencyInfoGraphSerializer::createNode));
methodToNode.entrySet().stream().forEach(methodAndNode -> {
if (info.hasMethodDependencies(methodAndNode.getKey())) {
graph.addComponent(methodAndNode.getValue());
} else {
simpleMethods.addComponent(methodAndNode.getValue());
}
});
graph.addComponent(simpleMethods);
for (final Method caller : methodToNode.keySet()) {
for (final Method callee : info.getMethodDependenciesInAppearanceOrder(caller)) {
graph.addComponent(createEdge(caller, callee, methodToNode, info));
}
}
final Comment comment = new Comment(getDescription());
graph.addComponent(comment);
return serialize(graph);
}
Aggregations