@Test public void testGetDominanceFrontiersEmptyGraph() { Map<Integer, Set<Integer>> expected = new HashMap<>(); expected.put(0, new HashSet<>()); expected.put(1, new HashSet<>()); assertEquals(expected, emptyGraph.getDominanceFrontiers()); }
public Map<V, Set<V>> getDominanceFrontiers() { if(dominanceFrontiers == null) { ensureDominatorsArrayIsCalculated(); dominanceFrontiers = new HashMap<>(); for(VertexInfo<V> vertexInfo : reachableVertices) { dominanceFrontiers.put(vertexInfo.value, new HashSet<V>()); } for(int i = 0; i < reachableVertices.size(); i++) { if(reachableVertices.get(i).predecessors.size() > 1) { IntSinglyLinkedList.IntListIterator itr = reachableVertices.get(i).predecessors.iterator(); while(itr.hasNext()) { int runner = itr.nextInt(); while(runner != dominators[i]) { dominanceFrontiers.get(reachableVertices.get(runner).value).add(reachableVertices.get(i).value); runner = dominators[runner]; } } } } for(V key : dominanceFrontiers.keySet()) { dominanceFrontiers.put(key, Collections.unmodifiableSet(dominanceFrontiers.get(key))); } dominanceFrontiers = Collections.unmodifiableMap(dominanceFrontiers); } return dominanceFrontiers; }
FlowGraph { public Map<V, Set<V>> getDominanceFrontiers() { if(dominanceFrontiers == null) { ensureDominatorsArrayIsCalculated(); dominanceFrontiers = new HashMap<>(); for(VertexInfo<V> vertexInfo : reachableVertices) { dominanceFrontiers.put(vertexInfo.value, new HashSet<V>()); } for(int i = 0; i < reachableVertices.size(); i++) { if(reachableVertices.get(i).predecessors.size() > 1) { IntSinglyLinkedList.IntListIterator itr = reachableVertices.get(i).predecessors.iterator(); while(itr.hasNext()) { int runner = itr.nextInt(); while(runner != dominators[i]) { dominanceFrontiers.get(reachableVertices.get(runner).value).add(reachableVertices.get(i).value); runner = dominators[runner]; } } } } for(V key : dominanceFrontiers.keySet()) { dominanceFrontiers.put(key, Collections.unmodifiableSet(dominanceFrontiers.get(key))); } dominanceFrontiers = Collections.unmodifiableMap(dominanceFrontiers); } return dominanceFrontiers; } }
FlowGraph { public Map<V, Set<V>> getDominanceFrontiers() { if(dominanceFrontiers == null) { ensureDominatorsArrayIsCalculated(); dominanceFrontiers = new HashMap<>(); for(VertexInfo<V> vertexInfo : reachableVertices) { dominanceFrontiers.put(vertexInfo.value, new HashSet<V>()); } for(int i = 0; i < reachableVertices.size(); i++) { if(reachableVertices.get(i).predecessors.size() > 1) { IntSinglyLinkedList.IntListIterator itr = reachableVertices.get(i).predecessors.iterator(); while(itr.hasNext()) { int runner = itr.nextInt(); while(runner != dominators[i]) { dominanceFrontiers.get(reachableVertices.get(runner).value).add(reachableVertices.get(i).value); runner = dominators[runner]; } } } } for(V key : dominanceFrontiers.keySet()) { dominanceFrontiers.put(key, Collections.unmodifiableSet(dominanceFrontiers.get(key))); } dominanceFrontiers = Collections.unmodifiableMap(dominanceFrontiers); } return dominanceFrontiers; } FlowGraph(Map<V, Set<V>> edges, V entryPoint, V exitPoint); private  FlowGraph(FlowGraph<V> originalGraph); }
FlowGraph { public Map<V, Set<V>> getDominanceFrontiers() { if(dominanceFrontiers == null) { ensureDominatorsArrayIsCalculated(); dominanceFrontiers = new HashMap<>(); for(VertexInfo<V> vertexInfo : reachableVertices) { dominanceFrontiers.put(vertexInfo.value, new HashSet<V>()); } for(int i = 0; i < reachableVertices.size(); i++) { if(reachableVertices.get(i).predecessors.size() > 1) { IntSinglyLinkedList.IntListIterator itr = reachableVertices.get(i).predecessors.iterator(); while(itr.hasNext()) { int runner = itr.nextInt(); while(runner != dominators[i]) { dominanceFrontiers.get(reachableVertices.get(runner).value).add(reachableVertices.get(i).value); runner = dominators[runner]; } } } } for(V key : dominanceFrontiers.keySet()) { dominanceFrontiers.put(key, Collections.unmodifiableSet(dominanceFrontiers.get(key))); } dominanceFrontiers = Collections.unmodifiableMap(dominanceFrontiers); } return dominanceFrontiers; } FlowGraph(Map<V, Set<V>> edges, V entryPoint, V exitPoint); private  FlowGraph(FlowGraph<V> originalGraph); V getEntryPoint(); V getExitPoint(); Map<V, Set<V>> getSuccessors(); Map<V, Set<V>> getPredecessors(); Set<V> getVertices(); Set<V> getSuccessors(V vertex); Set<V> getPredecessors(V vertex); FlowGraph<V> getTransverseGraph(); Map<V, V> getImmediateDominators(); Map<V, Set<V>> getDominatorTree(); Map<V, Set<V>> getDominatorSets(); Map<V, Set<V>> getDominanceFrontiers(); Map<V, V> getImmediatePostDominators(); Map<V, Set<V>> getPostDominatorSets(); Map<V, Set<V>> getPostDominanceFrontiers(); Set<NaturalLoop<V>> getNaturalLoops(); boolean containsPath(V source, V target); @Override boolean equals(Object o); @Override int hashCode(); void write(Writer writer, String graphName, Comparator<V> vertexComparator,
                      Function<V, String> printer, int fontSize); }
FlowGraph { public Map<V, Set<V>> getDominanceFrontiers() { if(dominanceFrontiers == null) { ensureDominatorsArrayIsCalculated(); dominanceFrontiers = new HashMap<>(); for(VertexInfo<V> vertexInfo : reachableVertices) { dominanceFrontiers.put(vertexInfo.value, new HashSet<V>()); } for(int i = 0; i < reachableVertices.size(); i++) { if(reachableVertices.get(i).predecessors.size() > 1) { IntSinglyLinkedList.IntListIterator itr = reachableVertices.get(i).predecessors.iterator(); while(itr.hasNext()) { int runner = itr.nextInt(); while(runner != dominators[i]) { dominanceFrontiers.get(reachableVertices.get(runner).value).add(reachableVertices.get(i).value); runner = dominators[runner]; } } } } for(V key : dominanceFrontiers.keySet()) { dominanceFrontiers.put(key, Collections.unmodifiableSet(dominanceFrontiers.get(key))); } dominanceFrontiers = Collections.unmodifiableMap(dominanceFrontiers); } return dominanceFrontiers; } FlowGraph(Map<V, Set<V>> edges, V entryPoint, V exitPoint); private  FlowGraph(FlowGraph<V> originalGraph); V getEntryPoint(); V getExitPoint(); Map<V, Set<V>> getSuccessors(); Map<V, Set<V>> getPredecessors(); Set<V> getVertices(); Set<V> getSuccessors(V vertex); Set<V> getPredecessors(V vertex); FlowGraph<V> getTransverseGraph(); Map<V, V> getImmediateDominators(); Map<V, Set<V>> getDominatorTree(); Map<V, Set<V>> getDominatorSets(); Map<V, Set<V>> getDominanceFrontiers(); Map<V, V> getImmediatePostDominators(); Map<V, Set<V>> getPostDominatorSets(); Map<V, Set<V>> getPostDominanceFrontiers(); Set<NaturalLoop<V>> getNaturalLoops(); boolean containsPath(V source, V target); @Override boolean equals(Object o); @Override int hashCode(); void write(Writer writer, String graphName, Comparator<V> vertexComparator,
                      Function<V, String> printer, int fontSize);  }