private Set<Flow> run(final ExplodedGraph.Node node, PSet<Symbol> trackedSymbols) { Set<Flow> flows = new HashSet<>(); Deque<ExecutionPath> workList = new ArrayDeque<>(); SameConstraints sameConstraints = new SameConstraints(node, trackedSymbols, domains); node.edges().stream().flatMap(e -> startPath(e, trackedSymbols, sameConstraints)).forEach(workList::push); int flowSteps = 0; Set<ExecutionPath> visited = new HashSet<>(workList); while (!workList.isEmpty()) { ExecutionPath path = workList.pop(); if (path.finished) { flows.add(path.flow); } else { path.lastEdge.parent.edges().stream() .filter(path::notVisited) .flatMap(path::addEdge) .forEach(ep -> { if(visited.add(ep)) { workList.push(ep); } }); } flowSteps++; if(flowSteps == MAX_FLOW_STEPS) { LOG.debug("Flow was not able to complete"); break; } } return flows; }
private Set<Flow> run(final ExplodedGraph.Node node, PSet<Symbol> trackedSymbols) { Set<Flow> flows = new HashSet<>(); Deque<ExecutionPath> workList = new ArrayDeque<>(); SameConstraints sameConstraints = new SameConstraints(node, trackedSymbols, domains); node.edges().stream().flatMap(e -> startPath(e, trackedSymbols, sameConstraints)).forEach(workList::push); int flowSteps = 0; Set<ExecutionPath> visited = new HashSet<>(workList); while (!workList.isEmpty()) { ExecutionPath path = workList.pop(); if (path.finished) { flows.add(path.flow); } else { path.lastEdge.parent.edges().stream() .filter(path::notVisited) .flatMap(path::addEdge) .forEach(ep -> { if(visited.add(ep)) { workList.push(ep); } }); } flowSteps++; if(flowSteps == MAX_FLOW_STEPS) { LOG.debug("Flow was not able to complete"); break; } } return flows; }