public static String toJSON(Map<String, Set<String>> map) { StringBuilder res = new StringBuilder(); res.append("{\n"); res.append(joinWith(Util.mapToSet(map.entrySet(), e -> { StringBuilder res1 = new StringBuilder(); if(e.getValue().size() > 0) { res1.append(" \"").append(e.getKey()).append("\": [\n"); res1.append(joinWith(Util.mapToSet(e.getValue(), str -> " \"" + str + '"'), ",\n")); res1.append("\n ]"); } return res1.length() == 0 ? null : res1.toString(); }), ",\n")); res.append("\n}"); return res.toString(); }
public static String toJSON(Map<String, Set<String>> map) { StringBuilder res = new StringBuilder(); res.append("{\n"); res.append(joinWith(Util.mapToSet(map.entrySet(), e -> { StringBuilder res1 = new StringBuilder(); if(e.getValue().size() > 0) { res1.append(" \"").append(e.getKey()).append("\": [\n"); res1.append(joinWith(Util.mapToSet(e.getValue(), str -> " \"" + str + '"'), ",\n")); res1.append("\n ]"); } return res1.length() == 0 ? null : res1.toString(); }), ",\n")); res.append("\n}"); return res.toString(); }
public static Map<String, Set<String>> extractEdges(CallGraph cg) { Map<String, Set<String>> edges = HashMapFactory.make(); for(CGNode nd : cg) { if(!isRealFunction(nd.getMethod())) continue; AstMethod method = (AstMethod)nd.getMethod(); for(CallSiteReference callsite : Iterator2Iterable.make(nd.iterateCallSites())) { Set<IMethod> targets = Util.mapToSet(cg.getPossibleTargets(nd, callsite), CGNode::getMethod); serializeCallSite(method, callsite, targets, edges); } } return edges; }
public static Map<String, Set<String>> extractEdges(CallGraph cg) { Map<String, Set<String>> edges = HashMapFactory.make(); for(CGNode nd : cg) { if(!isRealFunction(nd.getMethod())) continue; AstMethod method = (AstMethod)nd.getMethod(); for(CallSiteReference callsite : Iterator2Iterable.make(nd.iterateCallSites())) { Set<IMethod> targets = Util.mapToSet(cg.getPossibleTargets(nd, callsite), CGNode::getMethod); serializeCallSite(method, callsite, targets, edges); } } return edges; }