#include "treeprop.h" /****************************************************************************** Tree property checker. File name :cd_optimization.c Author :Christos Stamelos. Version :II Date :14 Jan 1991. ******************************************************************************/ /* This is the file which contains the code for cd optimization */ void Set_of_item_sets::cd_optimization() { itemsets->cd_optimization(); } void Item_set_list::cd_optimization() { DemIdent *globalident = new DemIdent("GLOBALIDENT"); int count = 0; Item_set_list_iterator next_arg(*this); Item_set_ each_arg; while(each_arg = next_arg()){ count +=1; if( !(((each_arg->get_item())->get_classname())->g_equal(globalident))){ Item_set_list_iterator next_arg_2(*this); Item_set_ each_arg_2; for(int j=1;j<=count;j++) each_arg_2 = next_arg_2(); while(each_arg_2=next_arg_2()) if( !(((each_arg_2->get_item())->get_classname())->g_equal(globalident))) if(!((each_arg->get_members())->intersec((each_arg_2->get_members())))->is_empty_set()) each_arg_2->set_members( (each_arg_2->get_members())->replace_subset_with_element(each_arg->get_members(),(each_arg->get_item())->get_classname())); } } } /* Diagnostics for intersected sets in case od tree property violation */ void Set_of_item_sets::diagnostics() { itemsets->diagnostics(); } void Item_set_list::diagnostics() { DemIdent *globalident = new DemIdent("GLOBALIDENT"); int count = 0; Item_set_list_iterator next_arg(*this); Item_set_ each_arg; while(each_arg = next_arg()){ count +=1; if( !(((each_arg->get_item())->get_classname())->g_equal(globalident))){ Item_set_list_iterator next_arg_2(*this); Item_set_ each_arg_2; for(int j=1;j<=count;j++) each_arg_2 = next_arg_2(); while(each_arg_2=next_arg_2()) if( !(((each_arg_2->get_item())->get_classname())->g_equal(globalident))) if ( !((each_arg_2->get_members())->set_difference(each_arg->get_members()))->is_empty_set() ){ cout<< "\nThe set [ "; (each_arg->get_members())->pp();cout << " ] is intersected with the set [ "; (each_arg_2->get_members())->pp();cout << " ]\n"; } } } }