#include "treeprop.h" /****************************************************************************** Tree property checker. File name :tree.c Author :Christos Stamelos. Version :II Date :14 Jan 1991. ******************************************************************************/ /* tree property checker */ int Set_of_belongs_to_sets::tree_property_checker(Set_of_tree_structures *isetoftreestructures) { return belongstosets->tree_property_checker(isetoftreestructures); } int Belongs_to_set_list::tree_property_checker(Set_of_tree_structures *isetoftreestructures) { Belongs_to_set_list_iterator next_arg(*this); Belongs_to_set_ each_arg; while (each_arg = next_arg()) if (! each_arg->tree_property_checker(isetoftreestructures )) return 0; return 1; } int Belongs_to_set::tree_property_checker(Set_of_tree_structures *isetoftreestructures) { int temp = cardinality->get_val(); Lc_list_iterator next_arg(*belogsto); Lc_ current; Lc_ next; current = next_arg(); int treeprop = 1; for ( int j=1;jcontains(next) ){ Tree_structure *itreestructure =new Tree_structure(next,(Lc *) 0,current ); (isetoftreestructures->get_treestructures())->append(itreestructure); treeprop = 1; } else{ treeprop = isetoftreestructures->update( current , next );} current = next; } return treeprop; } int Set_of_tree_structures::contains( Lc *ilc ) { if ( treestructures ) return treestructures->contains(ilc ); return 0; } int Tree_structure_list::contains( Lc *ilc ) { Tree_structure_list_iterator next_arg(*this); Tree_structure_ each_arg; while (each_arg = next_arg()) if ( (each_arg->get_item())->isequal( ilc ) ) return 1; return 0; } int Lc::isequal(Lc *iLc) { if ( iLc ) if ( labelname->g_equal(iLc->get_labelname() ) && classname->g_equal( iLc->get_classname())) return 1; return 0; } int Set_of_tree_structures::update( Lc *icurrent , Lc *inext ) { return treestructures->update( icurrent , inext ); } int Tree_structure_list::update( Lc *icurrent , Lc *inext ) { Tree_structure_list_iterator next_arg(*this); Tree_structure_ each_arg; while (each_arg = next_arg()) if ((each_arg->get_item())->isequal(inext)) if ((each_arg->get_iscontained())->isequal((Lc*) 0)){ each_arg->rset_iscontained( icurrent ); return 1; } else if (!(each_arg->get_iscontained())->isequal(icurrent)) return 0; else return 1; }