Commit 9e6bf3cb authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Optional cli options to suppress arcs from the output

Use '-DedgeNAME=false', where NAME can be structural, controlflow, control, flow, objectflow, value, valuestructure, totaldefinition, call, input, output or summary.
parent 301e2aa6
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public class DotFactory {
	// representation, to ease the debugging of graphs.

	// Edge types that will be ignored (none if empty)
	static final List<Edge.Type> ignoreEdgeTypes = Arrays.asList();
	static final List<Edge.Type> ignoreEdgeTypes = new LinkedList<>();
	// Edge types that will be included (all if empty)
	static final List<Edge.Type> edgeTypes = Arrays.asList();
	// static final List<Edge.Type> edgeTypes = Arrays.asList(Edge.Type.ControlFlow);
@@ -52,6 +52,26 @@ public class DotFactory {
	static final List<Integer> ignoredNodeIds = Arrays.asList();
	// =========================== END DEBUG CONFIGURATION =========================== //

	// Reads the commandline options (-Dedgecontrol=false removes control edges)
	static {
		Map<String, List<Edge.Type>> edgeNameMap = new HashMap<>();
		edgeNameMap.put("structural", List.of(Edge.Type.Structural));
		edgeNameMap.put("controlflow", List.of(Edge.Type.ControlFlow, Edge.Type.NonExecControlFlow));
		edgeNameMap.put("control", List.of(Edge.Type.Control));
		edgeNameMap.put("flow", List.of(Edge.Type.Flow));
		edgeNameMap.put("objectflow", List.of(Edge.Type.ObjectFlow));
		edgeNameMap.put("value", List.of(Edge.Type.Value));
		edgeNameMap.put("valuestructure", List.of(Edge.Type.ValueStructure));
		edgeNameMap.put("totaldefinition", List.of(Edge.Type.TotalDefinition));
		edgeNameMap.put("call", List.of(Edge.Type.Call));
		edgeNameMap.put("input", List.of(Edge.Type.Input));
		edgeNameMap.put("output", List.of(Edge.Type.Output));
		edgeNameMap.put("summary", List.of(Edge.Type.Summary));
		for (String key : edgeNameMap.keySet())
			if (System.getProperty("edge" + key, "true").equalsIgnoreCase("false"))
				ignoreEdgeTypes.addAll(edgeNameMap.get(key));
	}

	public static void createDot(File outputFile, EDG edg)
	{
		DotFactory.createDot(outputFile, edg, null, null, null);