Loading iacfg/pom.xml 0 → 100644 +39 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg</artifactId> <version>1.3.0</version> </parent> <artifactId>iacfg</artifactId> <properties> <maven.compiler.source>21</maven.compiler.source> <maven.compiler.target>21</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg-core</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg-cli</artifactId> <version>1.3.0</version> <scope>test</scope> </dependency> </dependencies> </project> No newline at end of file iacfg/src/main/java/es/upv/mist/slicing/arcs/InterferenceDependencyArc.java 0 → 100644 +10 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.arcs; import es.upv.mist.slicing.arcs.pdg.DataDependencyArc; import es.upv.mist.slicing.nodes.VariableAction; public class InterferenceDependencyArc extends DataDependencyArc { public InterferenceDependencyArc(VariableAction sourceVar, VariableAction targetVar) { super(sourceVar, targetVar); } } iacfg/src/main/java/es/upv/mist/slicing/graphs/icfg/ICFG.java 0 → 100644 +781 −0 File added.Preview size limit exceeded, changes collapsed. Show changes iacfg/src/main/java/es/upv/mist/slicing/graphs/scrs/AbstractSCR.java 0 → 100644 +38 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.graphs.scrs; import org.jgrapht.Graph; import org.jgrapht.graph.AsSubgraph; import java.util.Objects; import java.util.Set; /** * An abstract Strongly Connected Region (or Component) of a graph g, implemented as a subgraph of g. * This SCR can be freely modified (edges, vertices added and removed), and it will remain a part of the condensation. * * @param <V> The type of vertices in the original graph. * @param <E> The type of edges in the original graph. * @see AbstractSCRAlgorithm */ public abstract class AbstractSCR<V, E> extends AsSubgraph<V, E> { /** A unique id to */ protected int id; public AbstractSCR(Graph<V, E> base, Set<? extends V> vertexSubset, Set<? extends E> edgeSubset) { super(base, vertexSubset, edgeSubset); } public int getId() { return id; } @Override public int hashCode() { return Objects.hashCode(id); } @Override public boolean equals(Object obj) { return obj instanceof AbstractSCR scr && this.id == scr.id; } } iacfg/src/main/java/es/upv/mist/slicing/graphs/scrs/AbstractSCRAlgorithm.java 0 → 100644 +63 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.graphs.scrs; import org.jgrapht.Graph; import org.jgrapht.alg.connectivity.KosarajuStrongConnectivityInspector; import org.jgrapht.graph.DefaultEdge; import java.util.List; import java.util.Set; /** * A wrapper for a Strong Connectivity Algorithm, to modify the generated condensation and enable the modification * of such condensations, by using {@link AbstractSCR}.<br> * A condensation of the strongly connected regions of a {@code Graph<A, B>} with vertices of type {@code A} * and edges of type {@code B} is {@code Graph<Graph<A, B>, DefaultEdge>}, a new graph whose vertices are subgraphs * (strongly connected regions) of the initial graph, connected by {@link DefaultEdge}.<br> * This class uses a more specific type for the vertices of the condensation, yielding {@code Graph<R, DefaultEdge>} * for the condensation. This type is a wrapper on the subgraph, with implementations of {@code hashCode} and {@code equals} * that do not change when the graph changes, therefore allowing modifications. * * @param <V> The type of vertices on the original graph. * @param <E> The type of edges on the original graph. * @param <R> The type of vertices on the condensed graph. * @see org.jgrapht.alg.interfaces.StrongConnectivityAlgorithm * @see AbstractSCR */ public abstract class AbstractSCRAlgorithm<V, E, R extends AbstractSCR<V, E>> extends KosarajuStrongConnectivityInspector<V, E> { public AbstractSCRAlgorithm(Graph<V, E> graph) { super(graph); } public abstract R newSCR(Graph<V, E> graph, Set<V> nodeSet, Set<E> edgeSet); /** * Reimplementation of {@link org.jgrapht.alg.connectivity.AbstractStrongConnectivityInspector#getCondensation()} to wrap each strongly * connected component into a class with constant {@code hashCode} and {@code equals} implementation. * * @return A map, connecting each vertex in the original map to its location (region) in the condensation. */ public void copySCRs(CondensedGraph<V, E, R> condensation) { List<Set<V>> sets = stronglyConnectedSets(); for (Set<V> set : sets) { R component = newSCR(graph, set, null); condensation.addVertex(component); for (V v : set) { condensation.regionMap.put(v, component); } } for (E e : graph.edgeSet()) { V s = graph.getEdgeSource(e); R sComponent = condensation.regionMap.get(s); V t = graph.getEdgeTarget(e); R tComponent = condensation.regionMap.get(t); if (sComponent != tComponent) { // reference equal on purpose // TODO: instead of DefaultEdges, use a grouping class to hold multiple data edges (Arc, CallGraph.Edge) condensation.addEdge(sComponent, tComponent); } } } } Loading
iacfg/pom.xml 0 → 100644 +39 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg</artifactId> <version>1.3.0</version> </parent> <artifactId>iacfg</artifactId> <properties> <maven.compiler.source>21</maven.compiler.source> <maven.compiler.target>21</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg-core</artifactId> <version>1.3.0</version> </dependency> <dependency> <groupId>es.upv.mist.slicing</groupId> <artifactId>sdg-cli</artifactId> <version>1.3.0</version> <scope>test</scope> </dependency> </dependencies> </project> No newline at end of file
iacfg/src/main/java/es/upv/mist/slicing/arcs/InterferenceDependencyArc.java 0 → 100644 +10 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.arcs; import es.upv.mist.slicing.arcs.pdg.DataDependencyArc; import es.upv.mist.slicing.nodes.VariableAction; public class InterferenceDependencyArc extends DataDependencyArc { public InterferenceDependencyArc(VariableAction sourceVar, VariableAction targetVar) { super(sourceVar, targetVar); } }
iacfg/src/main/java/es/upv/mist/slicing/graphs/icfg/ICFG.java 0 → 100644 +781 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
iacfg/src/main/java/es/upv/mist/slicing/graphs/scrs/AbstractSCR.java 0 → 100644 +38 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.graphs.scrs; import org.jgrapht.Graph; import org.jgrapht.graph.AsSubgraph; import java.util.Objects; import java.util.Set; /** * An abstract Strongly Connected Region (or Component) of a graph g, implemented as a subgraph of g. * This SCR can be freely modified (edges, vertices added and removed), and it will remain a part of the condensation. * * @param <V> The type of vertices in the original graph. * @param <E> The type of edges in the original graph. * @see AbstractSCRAlgorithm */ public abstract class AbstractSCR<V, E> extends AsSubgraph<V, E> { /** A unique id to */ protected int id; public AbstractSCR(Graph<V, E> base, Set<? extends V> vertexSubset, Set<? extends E> edgeSubset) { super(base, vertexSubset, edgeSubset); } public int getId() { return id; } @Override public int hashCode() { return Objects.hashCode(id); } @Override public boolean equals(Object obj) { return obj instanceof AbstractSCR scr && this.id == scr.id; } }
iacfg/src/main/java/es/upv/mist/slicing/graphs/scrs/AbstractSCRAlgorithm.java 0 → 100644 +63 −0 Original line number Diff line number Diff line package es.upv.mist.slicing.graphs.scrs; import org.jgrapht.Graph; import org.jgrapht.alg.connectivity.KosarajuStrongConnectivityInspector; import org.jgrapht.graph.DefaultEdge; import java.util.List; import java.util.Set; /** * A wrapper for a Strong Connectivity Algorithm, to modify the generated condensation and enable the modification * of such condensations, by using {@link AbstractSCR}.<br> * A condensation of the strongly connected regions of a {@code Graph<A, B>} with vertices of type {@code A} * and edges of type {@code B} is {@code Graph<Graph<A, B>, DefaultEdge>}, a new graph whose vertices are subgraphs * (strongly connected regions) of the initial graph, connected by {@link DefaultEdge}.<br> * This class uses a more specific type for the vertices of the condensation, yielding {@code Graph<R, DefaultEdge>} * for the condensation. This type is a wrapper on the subgraph, with implementations of {@code hashCode} and {@code equals} * that do not change when the graph changes, therefore allowing modifications. * * @param <V> The type of vertices on the original graph. * @param <E> The type of edges on the original graph. * @param <R> The type of vertices on the condensed graph. * @see org.jgrapht.alg.interfaces.StrongConnectivityAlgorithm * @see AbstractSCR */ public abstract class AbstractSCRAlgorithm<V, E, R extends AbstractSCR<V, E>> extends KosarajuStrongConnectivityInspector<V, E> { public AbstractSCRAlgorithm(Graph<V, E> graph) { super(graph); } public abstract R newSCR(Graph<V, E> graph, Set<V> nodeSet, Set<E> edgeSet); /** * Reimplementation of {@link org.jgrapht.alg.connectivity.AbstractStrongConnectivityInspector#getCondensation()} to wrap each strongly * connected component into a class with constant {@code hashCode} and {@code equals} implementation. * * @return A map, connecting each vertex in the original map to its location (region) in the condensation. */ public void copySCRs(CondensedGraph<V, E, R> condensation) { List<Set<V>> sets = stronglyConnectedSets(); for (Set<V> set : sets) { R component = newSCR(graph, set, null); condensation.addVertex(component); for (V v : set) { condensation.regionMap.put(v, component); } } for (E e : graph.edgeSet()) { V s = graph.getEdgeSource(e); R sComponent = condensation.regionMap.get(s); V t = graph.getEdgeTarget(e); R tComponent = condensation.regionMap.get(t); if (sComponent != tComponent) { // reference equal on purpose // TODO: instead of DefaultEdges, use a grouping class to hold multiple data edges (Arc, CallGraph.Edge) condensation.addEdge(sComponent, tComponent); } } } }