Commit 0d6593ad authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Renamed graphs and replaced @NonNull with @NotNull

Also optimized imports
parent 9ba2e8d1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -131,9 +131,9 @@ public PDGGraph getSlice(File program, SlicingCriterion slicingCriterion) {

    Node astRoot = JavaParser.parse(programFile);

    PDGGraph pdgGraph = Graphs.PDG.fromASTNode(astRoot);
    PDGGraph pdg = Graphs.PDG.fromASTNode(astRoot);

    return pdgGraph.slice(slicingCriterion);
    return pdg.slice(slicingCriterion);
}

```
+4 −4
Original line number Diff line number Diff line
package tfm.exec;

import com.github.javaparser.ast.Node;
import tfm.graphs.CFGGraph;
import tfm.graphs.CFG;
import tfm.visitors.cfg.CFGBuilder;

public class CFGLog extends GraphLog<CFGGraph> {
public class CFGLog extends GraphLog<CFG> {

    public CFGLog() {
        super();
    }

    public CFGLog(CFGGraph graph) {
    public CFGLog(CFG graph) {
        super(graph);
    }

    @Override
    public void visit(Node node) {
        this.graph = new CFGGraph();
        this.graph = new CFG();
        node.accept(new CFGBuilder(graph), null);
    }
}
+10 −9
Original line number Diff line number Diff line
package tfm.exec;

import tfm.graphs.PDGGraph;
import com.github.javaparser.ast.Node;
import tfm.graphs.PDG;
import tfm.nodes.GraphNode;
import tfm.utils.Logger;
import tfm.visitors.pdg.PDGBuilder;
@@ -9,7 +10,7 @@ import java.io.IOException;
import java.util.Comparator;
import java.util.stream.Collectors;

public class PDGLog extends GraphLog<PDGGraph> {
public class PDGLog extends GraphLog<PDG> {

    private CFGLog cfgLog;

@@ -17,22 +18,22 @@ public class PDGLog extends GraphLog<PDGGraph> {
        this(null);
    }

    public PDGLog(PDGGraph pdgGraph) {
        super(pdgGraph);
    public PDGLog(PDG pdg) {
        super(pdg);

        if (graph != null && graph.getCfgGraph() != null)
            cfgLog = new CFGLog(graph.getCfgGraph());
        if (graph != null && graph.getCfg() != null)
            cfgLog = new CFGLog(graph.getCfg());
        else cfgLog = null;
    }

    @Override
    public void visit(com.github.javaparser.ast.Node node) {
        this.graph = new PDGGraph();
    public void visit(Node node) {
        this.graph = new PDG();

        node.accept(new PDGBuilder(graph), null);

        if (cfgLog == null) {
            cfgLog = new CFGLog(graph.getCfgGraph());
            cfgLog = new CFGLog(graph.getCfg());
        }
    }

+3 −3
Original line number Diff line number Diff line
package tfm.exec;

import com.github.javaparser.ast.Node;
import tfm.graphs.SDGGraph;
import tfm.graphs.SDG;
import tfm.visitors.sdg.SDGBuilder;

public class SDGLog extends GraphLog<SDGGraph> {
public class SDGLog extends GraphLog<SDG> {

    @Override
    public void visit(Node node) {
        this.graph = new SDGGraph();
        this.graph = new SDG();
        SDGBuilder sdgBuilder = new SDGBuilder(this.graph);
        node.accept(sdgBuilder, null);
    }
+15 −15
Original line number Diff line number Diff line
package tfm.graphbuilding;

import com.github.javaparser.ast.Node;
import tfm.graphs.CFGGraph;
import tfm.graphs.CFG;
import tfm.graphs.Graph;
import tfm.graphs.PDGGraph;
import tfm.graphs.SDGGraph;
import tfm.graphs.PDG;
import tfm.graphs.SDG;
import tfm.visitors.cfg.CFGBuilder;
import tfm.visitors.pdg.PDGBuilder;
import tfm.visitors.sdg.SDGBuilder;
@@ -23,41 +23,41 @@ public abstract class GraphOptions<G extends Graph> {
    protected abstract void buildGraphWithSpecificVisitor(G emptyGraph, Node node);
}

class CFGOptions extends GraphOptions<CFGGraph> {
class CFGOptions extends GraphOptions<CFG> {

    @Override
    public CFGGraph empty() {
        return new CFGGraph();
    public CFG empty() {
        return new CFG();
    }

    @Override
    protected void buildGraphWithSpecificVisitor(CFGGraph emptyGraph, Node node) {
    protected void buildGraphWithSpecificVisitor(CFG emptyGraph, Node node) {
        node.accept(new CFGBuilder(emptyGraph), null);
    }
}

class PDGOptions extends GraphOptions<PDGGraph> {
class PDGOptions extends GraphOptions<PDG> {

    @Override
    public PDGGraph empty() {
        return new PDGGraph();
    public PDG empty() {
        return new PDG();
    }

    @Override
    protected void buildGraphWithSpecificVisitor(PDGGraph emptyGraph, Node node) {
    protected void buildGraphWithSpecificVisitor(PDG emptyGraph, Node node) {
        node.accept(new PDGBuilder(emptyGraph), null);
    }
}

class SDGOptions extends GraphOptions<SDGGraph> {
class SDGOptions extends GraphOptions<SDG> {

    @Override
    public SDGGraph empty() {
        return new SDGGraph();
    public SDG empty() {
        return new SDG();
    }

    @Override
    protected void buildGraphWithSpecificVisitor(SDGGraph emptyGraph, Node node) {
    protected void buildGraphWithSpecificVisitor(SDG emptyGraph, Node node) {
        node.accept(new SDGBuilder(emptyGraph), null);
    }
}
 No newline at end of file
Loading