Newer
Older
package tfm.exec;
import guru.nidi.graphviz.engine.Format;
import tfm.graphs.PDGGraph;
import java.io.IOException;
import java.util.Comparator;
import java.util.stream.Collectors;
}
public PDGLog(PDGGraph pdgGraph) {
super(pdgGraph);
if (graph.getCfgGraph() != null)
cfgLog = new CFGLog(graph.getCfgGraph());
else cfgLog = null;
public void visit(com.github.javaparser.ast.Node node) {
node.accept(new PDGBuilder(graph), this.graph.getRootNode());
public void log() throws IOException {
super.log();
Logger.log("Nodes with variable info");
Logger.log(graph.getNodes().stream()
.sorted(Comparator.comparingInt(GraphNode::getId))
.map(node ->
String.format("GraphNode { id: %s, declared: %s, defined: %s, used: %s }",
node.getId(),
node.getDeclaredVariables(),
node.getDefinedVariables(),
node.getUsedVariables())
).collect(Collectors.joining(System.lineSeparator()))
public void generateImages(String imageName, Format format) throws IOException {
super.generateImages(imageName + "-pdg", format);
if (cfgLog != null)
cfgLog.generateImages(imageName + "-cfg", format);
public void openVisualRepresentation() throws IOException {
if (cfgLog != null)
cfgLog.openVisualRepresentation();
super.openVisualRepresentation();