@@ -0,0 +1,1305 @@
+package sds.assemble.controlflow;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A/**%0A * This class is for searching dominator node.%0A * @author inagaki%0A */%0Apublic class DominatorNodeSearcher %7B%0A%09/**%0A%09 * returns common dominator node from edges.%0A%09 * @param edge1 first edge%0A%09 * @param edge2 second edge%0A%09 * @return common dominator node%0A%09 */%0A%09public static CFNode searchCommon(CFEdge edge1, CFEdge edge2) %7B%0A%09%09return searchCommon(edge1.getDest(), edge2.getDest());%0A%09%7D%0A%0A%09/**%0A%09 * returns common dominator node from node and edge.%0A%09 * @param node target node%0A%09 * @param edge target edge%0A%09 * @return common dominator node%0A%09 */%0A%09public static CFNode searchCommon(CFNode node, CFEdge edge) %7B%0A%09%09return searchCommon(node, edge.getDest());%0A%09%7D%0A%0A%09/**%0A%09 * returns common dominator node from nodes.%0A%09 * @param node1 first node%0A%09 * @param node2 second node%0A%09 * @return common dominator node%0A%09 */%0A%09public static CFNode searchCommon(CFNode node1, CFNode node2) %7B%0A%09%09Set%3CCFNode%3E nodeSet = new HashSet%3C%3E();%0A%09%09nodeSet.add(node1);%0A%09%09while((node1 = node1.getImmediateDominator()) != null) %7B%0A%09%09%09nodeSet.add(node1);%0A%09%09%7D%0A%09%09nodeSet.add(node2);%0A%09%09while((node2 = node2.getImmediateDominator()) != null) %7B%0A%09%09%09if(nodeSet.contains(node2)) %7B%0A%09%09%09%09return node2;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09throw new CFNodeException(%22not found common dominator node.%22);%0A%09%7D%0A%7D

add class for searching common dominator node.