Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* Soot - a J*va Optimization Framework
   * Copyright (C) 1999-2010 Hossein Sadat-Mohtasham
   * This library is free software; you can redistribute it and/or
   * modify it under the terms of the GNU Lesser General Public
   * License as published by the Free Software Foundation; either
   * version 2.1 of the License, or (at your option) any later version.
   * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
 package soot.toolkits.graph.pdg;
 import java.util.List;
Constructs a multi-headed dominator tree. This is mostly the same as the DominatorTree but the buildTree method is changed to allow mutilple heads. This can be used for graphs that are multi-headed and cannot be augmented to become single-headed.

Hossein Sadat-Mohtasham March 2009
 public class MHGDominatorTree extends DominatorTree
 	public MHGDominatorTree(DominatorsFinder dominators)

Returns the root(s)!!! of the dominator tree.
         return (List<DominatorNode>) .clone();

This overrides the parent buildTree to allow multiple heads. Mostly copied from the super class and modified.
     protected void buildTree()
         // hook up children with parents and vice-versa
     	this. = null;
         for(Iterator godesIt = .iterator(); godesIt.hasNext();)
             Object gode =;
             DominatorNode dode = fetchDode(gode);
             DominatorNode parent = fetchParent(gode);
             if(parent == null){
             	//make sure the array is created!
             	if( == null)
                 	 = new ArrayList();
          = (DominatorNode.get(0);
         // identify the tail nodes
         for(Iterator dodesIt = this.iterator(); dodesIt.hasNext();)
             DominatorNode dode = (;
New to GrepCode? Check out our FAQ X