simplify/src/InclusionTree.cxx
// Search for an inclusion tree node having the given id,
// among the given node, its later siblings, and their descendants
// in depth-first order.  Assumes the id sought is greater than
// the ids of all of its ancestors their earlier siblings, to speed
// the algorithm.
Search for an inclusion tree node having the given id,
among the given node, its later siblings, and their descendants
in depth-first order.  Assumes the id sought is greater than
the ids of all of its ancestors their earlier siblings, to speed
the algorithm.
Search for an inclusion tree node having the given id among the given node its later siblings and their descendants in depth - first order . Assumes the id sought is greater than the ids of all of its ancestors their earlier siblings to speed the algorithm .
InclusionNode* InclusionTree::FindNodeById(InclusionNode* startFrom, int id)
{
  InclusionNode* ret = 0;
  while (startFrom)
    {
      if (startFrom->GetId() == id)
	{
	  ret = startFrom;
	  break;
	}
      InclusionNode* next = startFrom->GetNext();
      InclusionNode* first = startFrom->GetFirst();
      if (next && next->GetId() <= id)
	{
	  startFrom = next;
	}
      else if (first && first->GetId() <= id)
	{
	  ret = FindNodeById(startFrom->GetFirst(), id);
	  break;
	}
      else
	{
	  break;
	}
    }
  return ret;
}
InclusionNode * InclusionTree :: FindNodeById ( InclusionNode * startFrom , int id ) { InclusionNode * ret = 0 ; while ( startFrom ) { if ( startFrom -> GetId ( ) == id ) { ret = startFrom ; break ; } InclusionNode * next = startFrom -> GetNext ( ) ; InclusionNode * first = startFrom -> GetFirst ( ) ; if ( next && next -> GetId ( ) <= id ) { startFrom = next ; } else if ( first && first -> GetId ( ) <= id ) { ret = FindNodeById ( startFrom -> GetFirst ( ) , id ) ; break ; } else { break ; } } return ret ; }
Search for an inclusion tree node having the given id,
among the given node, its later siblings, and their descendants
in depth-first order.
Search for an inclusion tree node having the given id among the given node its later siblings and their descendants in depth - first order .