cloud9_root/src/third_party/stp/src/simplifier/SubstitutionMap.cpp
// Adds to the dependency graph that n0 depends on the variables in n1.
// It's not the transitive closure of the dependencies. Just the variables in the expression "n1".
// This is only needed as long as all the substitution rules haven't been written through.
Adds to the dependency graph that n0 depends on the variables in n1.
It's not the transitive closure of the dependencies. Just the variables in the expression "n1".
This is only needed as long as all the substitution rules haven't been written through.
Adds to the dependency graph that n0 depends on the variables in n1 . It ' s not the transitive closure of the dependencies . Just the variables in the expression " n1 " . This is only needed as long as all the substitution rules haven ' t been written through .
void SubstitutionMap::buildDepends(const ASTNode& n0, const ASTNode& n1)
{
	if (n0.GetKind() != SYMBOL)
		return;
	if (n1.isConstant())
		return;
	vector<Symbols*> av;
	vars.VarSeenInTerm(vars.getSymbol(n1), rhs_visited, rhs, av);
	sort(av.begin(), av.end());
	for (int i =0; i < av.size();i++)
	{
		if (i!=0 && av[i] == av[i-1])
			continue; 
		ASTNodeSet* sym = (vars.TermsAlreadySeenMap.find(av[i])->second);
		if(rhsAlreadyAdded.find(sym) != rhsAlreadyAdded.end())
			continue;
		rhsAlreadyAdded.insert(sym);
		rhs.insert(sym->begin(), sym->end());
	}
	assert (dependsOn.find(n0) == dependsOn.end());
	dependsOn.insert(make_pair(n0,vars.getSymbol(n1)));
}
void SubstitutionMap :: buildDepends ( const ASTNode & n0 , const ASTNode & n1 ) { if ( n0 . GetKind ( ) != SYMBOL ) return ; if ( n1 . isConstant ( ) ) return ; vector < Symbols * > av ; vars . VarSeenInTerm ( vars . getSymbol ( n1 ) , rhs_visited , rhs , av ) ; sort ( av . begin ( ) , av . end ( ) ) ; for ( int i = 0 ; i < av . size ( ) ; i ++ ) { if ( i != 0 && av [ i ] == av [ i - 1 ] ) continue ; ASTNodeSet * sym = ( vars . TermsAlreadySeenMap . find ( av [ i ] ) -> second ) ; if ( rhsAlreadyAdded . find ( sym ) != rhsAlreadyAdded . end ( ) ) continue ; rhsAlreadyAdded . insert ( sym ) ; rhs . insert ( sym -> begin ( ) , sym -> end ( ) ) ; } assert ( dependsOn . find ( n0 ) == dependsOn . end ( ) ) ; dependsOn . insert ( make_pair ( n0 , vars . getSymbol ( n1 ) ) ) ; }
Adds to the dependency graph that n0 depends on the variables in n1.
Adds to the dependency graph that n0 depends on the variables in n1 .
// Treat it like a set of Symbol* in effect. //cout << loopCount++ << " "; //cout << "initial" << rhs.size() << " Adding: " <<sym->size(); //cout << "final:" << rhs.size(); //cout << "added:" << sym << endl;