Skip to content
Snippets Groups Projects
Commit 7adc4847 authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Remove nullpointers from graph printing

parent a23b8d07
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,8 @@ public class DOTAttributes {
public Map<String, Attribute> build() {
Map<String, Attribute> map = new HashMap<>();
for (var entry : this.map.entrySet()) {
if (entry.getValue() == null)
continue;
Optional<String> string = entry.getValue().stream().reduce((a, b) -> a + "," + b);
string.ifPresent(s -> map.put(entry.getKey(), createAttribute(s)));
}
......
package es.upv.mist.slicing.cli;
import es.upv.mist.slicing.arcs.Arc;
import es.upv.mist.slicing.arcs.pdg.ConditionalControlDependencyArc;
import es.upv.mist.slicing.arcs.pdg.FlowDependencyArc;
import es.upv.mist.slicing.arcs.pdg.ObjectFlowDependencyArc;
import es.upv.mist.slicing.arcs.pdg.StructuralArc;
import es.upv.mist.slicing.arcs.pdg.*;
import es.upv.mist.slicing.arcs.sdg.InterproceduralArc;
import es.upv.mist.slicing.graphs.pdg.PDG;
......@@ -47,11 +44,14 @@ public class PDGLog extends GraphLog<PDG> {
public static DOTAttributes pdgEdgeAttributes(Arc arc) {
DOTAttributes res = new DOTAttributes();
res.set("label", arc.getLabel());
if (arc.getLabel() != null)
res.set("label", arc.getLabel());
if (arc.isDataDependencyArc()
|| arc instanceof FlowDependencyArc
|| arc instanceof ObjectFlowDependencyArc)
res.set("color", "red");
if (arc instanceof TotalDefinitionDependenceArc)
res.set("color", "pink");
if (arc instanceof StructuralArc)
res.add("style", "dashed");
if (arc.isObjectFlow() && !(arc instanceof InterproceduralArc))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment