Commit d7efed70 authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Created the SDG's ClassicSlicingAlgorithm

parent ed90b1f6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -65,6 +65,14 @@ public abstract class Arc extends DefaultEdge {
        throw new UnsupportedOperationException("Not a DataDependencyArc");
    }

    public boolean isInterproceduralInputArc() {
        return false;
    }

    public boolean isInterproceduralOutputArc() {
        return false;
    }

    /** @see CallArc */
    public final boolean isCallArc() {
        return this instanceof CallArc;
+11 −2
Original line number Diff line number Diff line
@@ -2,15 +2,24 @@ package tfm.arcs.sdg;

import org.jgrapht.io.Attribute;
import org.jgrapht.io.DefaultAttribute;
import tfm.arcs.Arc;

import java.util.Map;

public class CallArc extends Arc {
public class CallArc extends InterproceduralArc {
    @Override
    public Map<String, Attribute> getDotAttributes() {
        Map<String, Attribute> map = super.getDotAttributes();
        map.put("style", DefaultAttribute.createAttribute("dashed"));
        return map;
    }

    @Override
    public boolean isInterproceduralInputArc() {
        return true;
    }

    @Override
    public boolean isInterproceduralOutputArc() {
        return false;
    }
}
+15 −0
Original line number Diff line number Diff line
package tfm.arcs.sdg;

import tfm.arcs.Arc;

public abstract class InterproceduralArc extends Arc {
    protected InterproceduralArc() {
        super();
    }

    @Override
    public abstract boolean isInterproceduralInputArc();

    @Override
    public abstract boolean isInterproceduralOutputArc();
}
+15 −2
Original line number Diff line number Diff line
@@ -2,15 +2,28 @@ package tfm.arcs.sdg;

import org.jgrapht.io.Attribute;
import org.jgrapht.io.DefaultAttribute;
import tfm.arcs.Arc;
import tfm.nodes.GraphNode;
import tfm.nodes.type.NodeType;

import java.util.Map;

public class ParameterInOutArc extends Arc {
public class ParameterInOutArc extends InterproceduralArc {
    @Override
    public Map<String, Attribute> getDotAttributes() {
        Map<String, Attribute> map = super.getDotAttributes();
        map.put("style", DefaultAttribute.createAttribute("dashed"));
        return map;
    }

    @Override
    public boolean isInterproceduralInputArc() {
        return ((GraphNode<?>) getSource()).getNodeType() == NodeType.ACTUAL_IN &&
                ((GraphNode<?>) getTarget()).getNodeType() == NodeType.FORMAL_IN;
    }

    @Override
    public boolean isInterproceduralOutputArc() {
        return ((GraphNode<?>) getSource()).getNodeType() == NodeType.FORMAL_OUT &&
                ((GraphNode<?>) getTarget()).getNodeType() == NodeType.ACTUAL_OUT;
    }
}
+14 −1
Original line number Diff line number Diff line
@@ -2,15 +2,28 @@ package tfm.arcs.sdg;

import org.jgrapht.io.Attribute;
import org.jgrapht.io.DefaultAttribute;
import tfm.arcs.Arc;

import java.util.Map;

<<<<<<< HEAD:sdg-core/src/main/java/tfm/arcs/sdg/SummaryArc.java
public class SummaryArc extends Arc {
=======
public class ReturnArc extends InterproceduralArc {
>>>>>>> 303de98... Created the SDG's ClassicSlicingAlgorithm:sdg-core/src/main/java/tfm/arcs/sdg/ReturnArc.java
    @Override
    public Map<String, Attribute> getDotAttributes() {
        Map<String, Attribute> map = super.getDotAttributes();
        map.put("style", DefaultAttribute.createAttribute("bold"));
        return map;
    }

    @Override
    public boolean isInterproceduralInputArc() {
        return false;
    }

    @Override
    public boolean isInterproceduralOutputArc() {
        return true;
    }
}
Loading