public static boolean isConsistent(final Application app) { ConnectivityInspector<OPNode, DStream> inspector = new ConnectivityInspector<OPNode, DStream>(app); for (OPNode srcnode : app.getSources()) for (OPNode snknode : app.getSinks()) if (!inspector.pathExists(srcnode, snknode)) return false; return true; }
@Help("gives the details of the connected components of the pom graph") public String components(WorkingSession session) { StringBuilder res = new StringBuilder(); ConnectivityInspector<GAV, Relation> ccon = new ConnectivityInspector<>(session.graph().internalGraph()); res.append("There are " + ccon.connectedSets().size() + " weakly connected components<br/>"); for (Set<GAV> gavs : ccon.connectedSets()) { res.append("<br/>Set of connected GAVs :<br/>"); for (GAV gav : gavs) { res.append("- " + gav + "<br/>"); } } return res.toString(); }
@Help("general statistics on the session") public String main(WorkingSession session) { StringBuilder res = new StringBuilder(); res.append("There are " + session.graph().gavs().size() + " gavs<br/>"); StrongConnectivityInspector<GAV, Relation> conn = new StrongConnectivityInspector<>(session.graph().internalGraph()); res.append( "There are " + conn.stronglyConnectedSets().size() + " strongly connected components<br/>"); ConnectivityInspector<GAV, Relation> ccon = new ConnectivityInspector<>(session.graph().internalGraph()); res.append("There are " + ccon.connectedSets().size() + " weakly connected components<br/>"); CycleDetector<GAV, Relation> cycles = new CycleDetector<GAV, Relation>(session.graph().internalGraph()); res.append("Is there cycles ? " + cycles.detectCycles() + "<br/>"); return res.toString(); }