#include "set.h"
#include <bdd.h>

// Set Operations



bdd setUnion(bdd s1, bdd s2){
 bdd u;
 u = s1 | s2;
 return u;
 
}

bdd setIntersection(bdd s1, bdd s2){ 
 bdd u;
 u = s1 & s2;
 return u;
 
}

bdd setXOR(bdd s1, bdd s2){
 bdd u;
 u = s1 ^ s2;
 return u;
}

bool setIsMember(bdd feature, bdd family){ 
   bdd temp;
   temp = (feature & family);
   cout << "Inside is Memeber. the featrue based is:" << endl;
   bdd_printdot(feature);
   cout << "Inside is Memeber. the family based is:" << endl;
   bdd_printdot(family);
   if (bdd_satcount(temp)> 0)
   { 
      cout << " feature is a member here " << endl;
      return true;
   }
   else
   { 
      cout << " feature is Not a member here " << endl;
      return true;
   }


}


bdd setComplement(bdd family){
	
	return bdd_not(family);
	
}

void setInsert(bdd feature, bdd &family){
	
	family = feature | family;
}

void setRemove(bdd feature, bdd &family){
	
	family = bdd_exist(family, feature);
}
 
bool setIsEmpty(bdd family){
	
	if (family == bdd_true())
	   return true;
	else
	   return false;
}

void setEnumerate(bdd family){
     cout << "{ "; 
     for (int i = 0; i < levels; i++)
     {  
     	if ((i < levels -1))
     		cout << i << ", " ;
        else
           cout  << i ;
	 }
	 cout << "}" << endl;
}


